Can't rename image sizes
-
Some time ago I have added a new image sizes into “functions.php” on my theme by the use of “add_image_size” function. Now I decided to bring my sites to unified standards. It is necessary for me to be able to use the same files in different themes.
For the foregoing reasons, I now want to rename some image sizes.
For example, in order to do that I find this line in “functions.php”:
add_image_size( 'post-gallery-thumbnail', 160, 90, true );
…and replace it with this:
add_image_size( 'thumbnail_primary', 160, 90, true );
In doing so, I did not change the sizes, only the names.
Of course I also replace all occurrences of the old name to the new (in my theme files). For example, I find:
echo '<img src="' . $image['sizes']['post-gallery-thumbnail'] . '" alt="' . $image['alt'] . '" />';
…and replace it with this:
echo '<img src="' . $image['sizes']['thumbnail_primary'] . '" alt="' . $image['alt'] . '" />';
Unfortunately after that my image sizes no longer work. In all cases the output is full image size.What caused the problem and how it can be solved?
P.S.: I suppose that it is possible the regeneration of thumbnails can help. But for some reason I want to avoid this option. And I think that this can be avoided, since image sizes are not changed, and file names of images must remain the same.
- The topic ‘Can't rename image sizes’ is closed to new replies.