Situation :
When uploading an image via the media uploader, WP automatically makes at least 3 additional sizes, that comes to 4 images including the original one. Most of the time, the images will be used at most 2 ( 1 thumbnail for the archive page and 1 for within the post itself. )
Problem :
Before long, the site will be bloated with unused images, and that’s ok until the time to backup site.
Suppose a new WP site is up and there will be 1 post per day with 1 image per post, for a year, we will have 365 times 4 image files sitting in the upload folder ( 1460 files).
Within 3 years, we will have 4,380 image files all together !!!
Solution :
So how do you handle this ?
A simple answer is that you can remove 2 unused sizes by enter 0 for their width or height. For example, you need only the small thumbnail 150×150 and full-sized image, so enter 0 for width and height of Medium and Large sizez.
Another chance to recommend two plugins I created that together will do what you want. Virtual intermediate images will intercept the creation of the intermediate image sizes: they will not be created on disk, but still exist in the metadata array. This makes WordPress think they exist so you can use them like normal images. The companion plugin, On-Demand Resizer will create missing image sizes when they are requested. The first time the image is requested it is created, all subsequent requests will just be served the newly created image.
Images sizes for the purpose of creating/deleting attachments seem to be retrieved with
get_intermediate_image_sizes()
function, that isn’t documented in Codex (only briefly mentioned in 3.0 release notes).That function passes result (combined set of default and custom image sizes) through
intermediate_image_sizes
filter, so you can likely use that hook to disable unwanted sizes.See source for details.