WordPress Thumbnails – From Molehill to Mountain
An unassuming WordPress setting led to over 100,000 image files and dozens of gigabytes of storage use. The cause turned out to be automatically generated image sizes.
3 min read
Sometimes a small technical detail hides a much bigger problem than you'd expect. In my case, it all started with a simple question:
Why does backing up a relatively small WordPress site take several hours?
The answer led me deep into WordPress's media management — and to quite a surprise.
What are thumbnails, exactly?
A thumbnail is a scaled-down preview version of an image.
WordPress generates these image sizes automatically so images can be delivered efficiently across different devices. Alongside the original image, this creates additional versions at various resolutions.
In principle, that's a good thing. It becomes a problem, though, when themes and plugins register their own image sizes and create even more variants for every uploaded image.
The actual problem
On my own website, I'd wondered for a while why backups were taking an unusually long time.
The problem really became obvious on my mother's website, though. Numerous photos of knitting projects had been published there. From the outside, the site looked completely normal. Behind the scenes, the picture looked very different:
- more than 110,000 files in the uploads directory
- around 28 GB of storage used by the site
- backups were becoming increasingly problematic
It quickly became clear that this couldn't be explained by the actually uploaded photos alone.
Where did all these files come from?
A closer look revealed the cause.
WordPress creates several image sizes by default. On top of that, various themes and plugins had registered their own sizes. As a result, numerous additional variants were created for every uploaded photo.
In this particular case, over 40 image versions were sometimes generated per photo.
Even if each individual file is relatively small, that adds up to an enormous amount of storage over the years.
The solution
After testing a few different tools, I came across the plugin Stop Generating Image Sizes.
Its biggest advantage:
- an overview of all registered image sizes
- which theme or plugin each one belongs to
- the ability to selectively enable or disable individual sizes
- full control over future uploads
This made it possible to disable unnecessary image sizes while keeping the thumbnails that were actually needed.
Cleaning up the uploads folder
The bigger challenge afterward was cleaning up the files that already existed.
For this, the unneeded image variants were identified directly in the uploads directory and removed.
The result was impressive:
- from over 110,000 files down to around 2,300 images
- from about 56 GB down to around 3 GB of storage including backups
- noticeably faster backups
- significantly less storage needed on the server
What can be learned from this
This experience once again showed how quickly technical debt can pile up.
With WordPress in particular, it's worth regularly checking:
- which plugins are actually needed
- which image sizes are being generated
- how large the uploads folder has grown
- whether backups are using unnecessarily large amounts of storage
Many performance and storage problems aren't caused by a few large files, but by thousands of small files accumulating over the years.
Conclusion
In this case, WordPress itself wasn't really the problem. Rather, the combination of themes, plugins, and automated image sizes meant dozens of extra versions were being stored for every photo.
Anyone running a WordPress site with lots of images should therefore take a regular look at the image sizes being generated. The effort is small — the savings can be enormous.
A big thank you to my wonderful mum, whose website ultimately kicked off this little technical investigation.
Jackie