neven stepar neven stepar - 1 year ago 209
PHP Question

Wordpress thumbnail sizes

In my functions.php i defined 2 dimensions i want to use on my site, small and custom-size and my file looks like this:

add_image_size('small', 120, '', true);
add_image_size('custom-size', 755, 220, true);

When i check my wp-content/uploads folder, except original image and 120px and 755px images i see several others dimensions (150px, 768px) and i was wondering why is that showing if i only have 2 dimensions (i am asking because i am on limited hosting and want to save on disk space because i host a lot of images).

Thank you!

Answer Source

There are generally three reasons that these other sizes could be showing up:

  • You had different thumbnail dimensions / image sizes in the past. Images are not re-created (or deleted) when you change image sizes, but you can use a plugin such as Regenerate Thumbnails to do this for you - just click the options it adds under the Tools menu, after you have changed your image sizes.

  • You have a plugin or theme installed that is creating additional image sizes. To track down what is doing this, you can either search through the files for add_image_size, or you could deactive plugins/change themes and then regenerate your thumbnails to see what the result is.

  • Wordpress has a new hidden image size for responsive images. This applies in the case of the 768px image. See this WP Core blog post for details. If you have no need for responsive images you could change the size that applies to this image using the instructions in that blog post (running eg. update_option('medium_large_size_w', '755') or even manually updating the option in the database - it's in the wp_options table). Again - regenerate thumbnails after doing this.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download