Envira Gallery Blog
Digital Photography Tips, Tutorials and Resources
Digital Photography Tips, Tutorials and Resources
by Waseem Abbas on Dec 8, 2016
Did you know that WordPress generates additional image sizes whenever you upload a photo? These extra images take up space on your hosting server. For a photographer with hundreds of thousands of photos, these additional image sizes can create issues. In this tutorial, we will share how to stop WordPress from generating image sizes.
Whenever you upload one image to WordPress, it can turn into 5 or more images because of the additional sizes that WordPress (and your particular theme) generates. To stop WordPress from generating different image sizes, you’ll need to follow these 3 steps:
Ready to get started? Let’s go!
First thing you need to make sure is that you choose a reliable WordPress hosting like Hostgator or WPEngine that gives you decent disk space to upload all your photos.
Especially if you’re a photographer or uploading a lot of photos, we recommended that you always keep regular backups of your WordPress site. In fact, every website owner should be keeping backups in case anything goes wrong with your site.
However, even though you have a lot of space to upload many photos, these extra photos will slow down your backup process and create heavy backup files on your server.
If you aren’t using these additional image sizes anyway, then you can disable them by following the remaining steps below…
When you upload an image in WordPress, it creates three default sizes: thumbnail, medium and large. However, you may also find other image sizes being generated by your WordPress theme.
To check for additional image sizes, you can go to Media » Add New from your WordPress backend. Go ahead and upload an image.
Now you should connect your site using FTP client or cPanel. Simply go to the /wp-content/uploads/ directory.
All of the photos you’ve uploaded are sorted by year and month. (To learn more, you can also check out where does WordPress store uploaded images.)
Now you can see the number of copies generated by WordPress. Here’s a screenshot example:
In our case, we have 6 extra sizes being generated for each image uploaded. These include the default WordPress sizes, and images that are generated by our particular WordPress theme.
Next, since you now know the number of additional copies for each image, you can simply go to Settings » Media from your WordPress admin backend.
Then you’ll need to change all the values to 0, so it will stop WordPress from generating additional image sizes of your photos.
Now we have taken care of the 3 default sizes generated by WordPress, but there are still 3 more being generated by our theme. In the next step, we’ll need to stop our WordPress theme from adding extra copies of images…
Other image sizes aside from the 3 default sizes are being generated by your theme. To stop this, go to Appearance » Editor and edit the functions.php file of your theme.
In this file, you will see a few lines of code that look similar to this example below:
set_post_thumbnail_size( 1200, 9999 );
add_image_size( 'homepage-thumb', 220, 180, true );
These functions like set_post_thumbnail_size and add_image_size are used in your theme’s file to create additional image sizes. Simply delete these lines of code to prevent your WordPress theme from creating any additional copies of your images.
That’s all. We hope this article has helped you to learn how to stop WordPress from generating image sizes. You may also want to check out our guide on how to resize WordPress images automatically.
If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.
Envira Gallery helps photographers create beautiful photo and video galleries in just a few clicks so that they can showcase and sell their work.
Hello,
I have a running image sharing website, usually, we insert more than 20 images in a single post. I want to prevent WordPress from generating different image sizes for inserted images, except for the post featured image.
For example, If there are 20 images in my post. I want WP to generate image sizes for the Featured image only, and for other inserted images i don’t want different sizes.
Actually, the problem is the limited storage space and the other problem is that with those useless image sizes the backup file has more size.
How can I achieve this?
I appreciate your help.
Thanks for the article Waseem
But won’t the theme functions file be overwritten when the theme is updated? Shouldn’t this be done in a child theme?
Hey Ostii, yeah you can create a child theme in case of theme updates to secure the code. Here’s how you can create a child theme in WordPress. 🙂
I did what you said but now I have no feature image. I’m tired of wordpress adding multiple images. It should be one compressed image.
This is likely because the theme is using 1 of those sizes that you have removed. Most likely the thumbnail size. Add the thumbnail size back in and see if that corrects your featured images. If the theme is using a different image size then you could repeat that for each size in WordPress >> Settings >> Media. But this is the theme causing the issue. Hope that helps!