Too Many Thumbnails


#1

One of my biggest peeves with WP over the years is thumbnail images. Why does the system have to create SO MANY? :anguished: Themes have made this problem worse, and sometimes they are still a plague even after setting all media sizes to zero, editing theme functions or using a specific plugin to stop them. (Obviously, this doesn’t apply to all themes, but you get the idea.) I have resorted to linking images from a third party site to avoid this nonsense.

Will future versions of CP address this issue? Because it really needs to go away. :neutral_face:


#2

I do understand this problem, it is a peeve of me too. Maybe you should start a petition?


#3

@janelockwood The core has functions (https://developer.wordpress.org/reference/functions/add_image_size/) that will let the theme authors/plugins to add image sizes to the system. This means that each time an image is uploaded it will be generated an image for each different size.

I understand the problem, if you 20 image sizes, for each image you upload it will generate 20 different images.

The images need to be generated prior to the frontend requests them.

There isn’t an easy solution for this, maybe some algorithm that checks if an image size is used or not and deletes/creates new images when the content changes.


#4

Maybe the power is in data. Right now there’s no way to know how many thumbnails each image has, no way to know of any orphaned images, etc.

What would make this easier to work with is being able to provide that data. Being able to open an image in media library and see a list of thumbnails that image has.

Provide a page or filtering option on the main media library page to view orphaned images - images not attached to any posts.

I’ve done work with thumbnails, reducing uploads directory from 20gb to 9gb. Some images had over 50 thumbnails.

There’s a plugin that provides tools to make this easier, but the scanning it does is heavy on the server and will time out. I had to do it on my PC, letting it run over 48 hrs to try and find images that could be deleted. Granted this was a huge blog, thousands of posts and over 250k images.

If CP decides to use shortcodes instead of image tags, this might make this process easier. But until then, providing information about thumbnails and showing orphaned images might be the only sensible thing we can do.


#5

The Regenerate Thumbnails plugin is fantastic for re-creating thumbnails and deleting unused ones.


#6

It will not delete unused ones, not very well. When I worked on 20gb site, my first idea was to use Regenerate Thumbnails plugin. So I ran a test. It barely deleted any thumbnails, and I ended up with more thumbnails than I started as it created new thumbnails registered in new theme. Although this was last year, I believe delete option was in beta/testing stage. People are still complaining about it though.


#7

Sad day. :frowning: I’ve counted on that plugin for a lot of jobs and had good results. Guess I’ll have to look for something else, too.


#8

It works well for regeneration though.


#9

Maybe I should!


#10

Oh god. That’s terrible. :open_mouth:

Your situation is also part of the problem: why should we have to use a plugin to control (ha!) an issue that shouldn’t be happening the first place and just makes it worse?


#11

lol, I just wrote an article about this https://www.roughpixels.com/unused-wordpress-post-thumbnails/

But the reality is, in WordPress, even if you don’t have any thumbnail settings defined, even from the theme, WP still does it when you insert an image. Ever look and see the mobile versions of an image being loaded with srcset ?

Personally, NO additional thumbnails should be created except the one the user uploads.


#12

While this would clean up the server… that would mean any place an image was used, it would have to be resized via CSS (or uploaded again at new dimensions). A header-size image and icon-sized image using the same uploaded image would introduce an even worse problem, IMO.


#13

To get around this problem I use “Resize on the fly” scripts like Aqua-Resizer and mr-image-resize, they are great and avoid hundreds of unnecessary thumbnails.

Cutting is done on the first request and since then the thumbnail remains there. Plugins like Regenerate-Thumbnails can clean up if need be.

I also use function to disable medium_large images generation and max_srcset_image_width.