That’s exactly what ‘Folders to optimize’ is for, and also why the plugin keeps track of all images it has optimized separate from the Media Library metadata. Not everyone needs to scan their entire wp-content/uploads/ folder. For some, it would be rather painful when they have 100,000 images in their database.
Same thing for the plugins folder. I prefer (for the sake of efficiency), to only scan folders that actually have images to be displayed on the front-end. So we rely on the site owners to specify which folders to scan.
Might just be my opinion, but any images created in the wp-content/uploads/ folder should be stored in the image metadata under resizes. It is much more efficient to query the database for a list of images than to scan an entire folder of 1,000’s of images.
If you have particular (plugin) folders that you know need to be scanned, we can add those to the auto-detection routine, but I can’t/won’t tell the plugin to just blindly scan the entire plugins folder on the thousands of sites running EWWW I.O. Long-term, it is preferable to contact the plugin authors and ask them to optimize their images, which would save lots of people bandwidth (including the wp.org servers).
Uh, that’s really nice. I didn’t realize that there is a feature like this in the plugin. If we have an opportunity like this, we don’t need to check all of the folders that is full of images. Thank you so much…
But, one more question, when we add new media, it won’t optimize it’s mentioned thumbs automatically. So, what is the solution for it? Please don’t say optimize the folder once a week or something like that. 🙂
There are a couple solutions, depending on your abilities. From looking at the codex page on get_the_post_thumbnail, you can also use add_image_size to register with WordPress that it should be generating the size you want on upload for every image. This will also dump it in the attachment metadata (in the database), which is where that information belongs.
All that said, so long as get_the_post_thumbnail is “doing the right thing” and using the WP_Image_Editor class on the backend, all those sizes will be optimized when they are created.
I couldn’t guarantee that without testing it, but you should be able to test it yourself by uploading an image, then doing whatever is necessary to generate that resize (presumably inserting it in a post/page, and then viewing said post/page). Lastly, visit the Bulk Optimize page, and click Show Optimize Images to verify that the resize is in the list as optimized.
Short term, if that isn’t working as it should be, you can optimize them every hour automatically with the scheduled optimizer. The scheduled optimization function is intended to call the Scan & Optimize function via wp_cron, once per hour. If you’re on shared hosting, and have tons of images, that could be problematic, as it is going to hammer your database during the Scan portion as often as once per hour. If you have a VPS or dedicated server, it shouldn’t be too big of a deal.
I’ve add this code in my theme function.php:
// THUMB IMAGE REGISTRATION
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'homepage-small-thumb', 59, 42, true );
}
It works now. Thank you!