-
AuthorPosts
-
May 29, 2019 at 2:21 pm #1105166
Hello,
I have a client that needs to compress 35,000+ images with the tinypng plugin.
There are many image size versions in this installation and I find several articles on the web suggesting we should deselect some of the generated image sizes in the list to save space. However, doing so could break pages or posts on this site. I know the images sizes that are generated are designed so everything will just “magically work”.
I have two questions:
1. How many images sizes does Enfold place by default? I see 20 in my WordPress dashboard (see screenshot). I imagine some are WordPress default and some are Enfold default. Can you tell me which are which?
2. Is there a way to determine which images sizes are unnecessary or not currently used by the theme or this particular website? Is there a plugin for that? Or, are they all necessary if you want the site to work smoothly? For example, if I am not using Enfold for an e-commerce site could I deselect from being generated Shop Thumbnail, Shop Catalog, Shop Single?
3. Can someone please give me a verbose explanation of how this works and the best method of dealing with this? The goal is to, upon image upload, only generate necessary image sizes while making certain necessary image sizes are generated so the site functions smoothly.
This is not typically an issue, but this site has 35,000+ images.
https://www.dropbox.com/s/aswlyubfpm3m0z7/Screen%20Shot%202019-05-23%20at%203.42.16%20AM.png?dl=0
Thanks,
Jas
June 1, 2019 at 6:23 pm #1106159Hey Jasmer,
Sorry for the late reply, WordPress creates these sizes by default:
Thumbnail
Medium
Medium Large
Large
But your site may not use all of these.
The rest are created by Enfold, to help work smoothly, but typically multiple image sizes are available in the page for each size to help with screen sizes, so if one is not available the browser will get the next size.
The easiest way to choose which ones you want to use is to use the plugin Simple Image Sizes. So if you are not using the woocommerce shop you can uncheck those or set their size to zero, the same for other sizes.
You can also choose to not use a size, and then choose to use it in the future by using the image regeneration option in the plugin.Best regards,
MikeJune 10, 2019 at 9:58 pm #1108885Hi Mike,
I want to wrap my head around every possibility. I’ll number for clarity:
1. Simple Image Sizes offers the same options as Regenerate Thumbnails correct? I’ve used Regenerate Thumbnails.
2. However, in the Regenerate Thumbnails description the developer of that plugin says this:
“The Site Accelerator (formerly photon) module makes the images on your site be served from WordPress.com’s global content delivery network (CDN) which should speed up the loading of images. Importantly though it can create thumbnails on the fly which means you’ll never need to use this plugin.”3. Am I understanding correctly, if I am using Site Accelerator (formerly photon), or any CDN, I could uncheck every box other than “Original image” and save an incredible amount of storage space?
– I imagine I would store the original image on my host and the other image sizes would be created “on the fly”.
– What is the best way to delete all the sizes other than the originals from my host?
– Or am I oversimplifying? What exactly is the developer suggesting and how exactly would this be implemented?Note: I am currently using Site Accelerator but have not deleted any image size files, yet.
Please feel free to give a verbose explanation of how this might function. This site has 35,000+ images.
Thank you so much
June 10, 2019 at 11:34 pm #1108904look to functions.php of your enfold theme (parent) around line 148ff
here without the comments in it:$avia_config['imgSize']['widget'] = array('width'=>36, 'height'=>36); $avia_config['imgSize']['square'] = array('width'=>180, 'height'=>180); $avia_config['imgSize']['featured'] = array('width'=>1500, 'height'=>430 ); $avia_config['imgSize']['featured_large'] = array('width'=>1500, 'height'=>630 ); $avia_config['imgSize']['extra_large'] = array('width'=>1500, 'height'=>1500 , 'crop' => false); $avia_config['imgSize']['portfolio'] = array('width'=>495, 'height'=>400 ); $avia_config['imgSize']['portfolio_small'] = array('width'=>260, 'height'=>185 ); $avia_config['imgSize']['gallery'] = array('width'=>845, 'height'=>684 ); $avia_config['imgSize']['magazine'] = array('width'=>710, 'height'=>375 ); $avia_config['imgSize']['masonry'] = array('width'=>705, 'height'=>705 , 'crop' => false); $avia_config['imgSize']['entry_with_sidebar'] = array('width'=>845, 'height'=>321); $avia_config['imgSize']['entry_without_sidebar'] = array('width'=>1210, 'height'=>423 ); $avia_config['imgSize'] = apply_filters('avf_modify_thumb_size', $avia_config['imgSize']);
filter avf_modify_thumb_size – how to use it ?
e.g:function custom_modified_thumb_sizes( $size ){ $size['square'] = array('width'=>300, 'height'=>300 ); return $size; } add_filter('avf_modify_thumb_size', 'custom_modified_thumb_sizes', 10, 1 );
June 11, 2019 at 7:59 am #1109028maybe this function can help you – but after that you had to regenerate image files – there are a lot of those tools – i guess the force regenerate thumbnails is the one which removes unneeded files too.
the first function is for not to use a srcset for images// remove "responsive images" functionality in WP 4.4 and higher add_filter('wp_get_attachment_image_attributes', function($attr) { if (isset($attr['sizes'])) unset($attr['sizes']); if (isset($attr['srcset'])) unset($attr['srcset']); return $attr; }, PHP_INT_MAX); add_filter('wp_calculate_image_sizes', '__return_false', PHP_INT_MAX); add_filter('wp_calculate_image_srcset', '__return_false', PHP_INT_MAX); remove_filter('the_content', 'wp_make_content_images_responsive'); // Disable loads of Enfold & WP image sizes upon upload // do image sizes manually, double-size with high compression for retina screens // use Photoshop to set exact double size and quality between Q30 and Q40 add_action('init', 'remove_enfold_image_sizes'); function remove_enfold_image_sizes() { // do NOT remove widget size, is used in backend portfolio items! // remove_image_size('widget'); remove_image_size('square'); remove_image_size('featured'); remove_image_size('featured_large'); remove_image_size('portfolio'); remove_image_size('portfolio_small'); remove_image_size('gallery'); remove_image_size('magazine'); remove_image_size('masonry'); remove_image_size('entry_without_sidebar'); remove_image_size('entry_with_sidebar'); remove_image_size('shop_thumbnail'); remove_image_size('shop_catalog'); remove_image_size('shop_single'); remove_image_size('shop_gallery_thumbnail'); } // Remove unneeded WP image sizes add_filter( 'intermediate_image_sizes_advanced', 'prefix_remove_default_images' ); // Remove default image sizes here. function prefix_remove_default_images( $sizes ) { // do NOT remove small and medium sizes, they are used in backend Media Library! // unset( $sizes['small']); // 150px // unset( $sizes['medium']); // 300px unset( $sizes['large']); // 1024px unset( $sizes['medium_large']); // 768px return $sizes; }
test it on a testinstallation. I tested it on a wordpress playground with enfold installation without any conflict.
All Credits goes to: https://kriesi.at/support/topic/responsive-content-images-retina-screens/#post-1077293June 11, 2019 at 11:16 am #1109086Guenni007,
I think I’m looking to understand the pros and cons of CDN’s. From what I understand, if I employ a CDN, it saves server space, decreases page load time and makes all this complication unnecessary. I’ll keep this in mind for the future though.
Thank you
June 11, 2019 at 11:17 am #1109088I’ll repost so the original question isn’t lost…
Hi,
I want to wrap my head around every possibility. I’ll number for clarity:
1. Simple Image Sizes offers the same options as Regenerate Thumbnails correct? I’ve used Regenerate Thumbnails.
2. However, in the Regenerate Thumbnails description the developer of that plugin says this:
“The Site Accelerator (formerly photon) module makes the images on your site be served from WordPress.com’s global content delivery network (CDN) which should speed up the loading of images. Importantly though it can create thumbnails on the fly which means you’ll never need to use this plugin.”3. Am I understanding correctly, if I am using Site Accelerator (formerly photon), or any CDN, I could uncheck every box other than “Original image” and save an incredible amount of storage space?
– I imagine I would store the original image on my host and the other image sizes would be created “on the fly”.
– What is the best way to delete all the sizes other than the originals from my host?
– Or am I oversimplifying? What exactly is the developer suggesting and how exactly would this be implemented?Note: I am currently using Site Accelerator but have not deleted any image size files, yet.
Please feel free to give a verbose explanation of how this might function. This site has 35,000+ images.
Thank you so much
June 11, 2019 at 9:18 pm #1109288In my opinion, the above is indeed relevant. Because to prevent the automatic generation of the image sizes you have to set this.
Your question is first about how you can delete the generated alternative images. I think, if you e.g. use this “force regenerate thumbnail” and have used that code before, the files that are no longer needed will be deleted.
There shouldn’t be any performance reasons when using a CDN, only memory space savings are achieved.June 13, 2019 at 3:35 am #1109642Hi,
You should not remove the thumbnails because the plugin won’t be able to use them. The Site Accelerator(formerly photon) plugin just transfers the images or thumbnails from your server to their CDN as explained in the following section. It lessens the requests made to your own server and does actually help optimize the site by serving images from a different and more adjacent network.
Our image CDN (formerly Photon) is an image acceleration and editing service. That means that we host your images from our servers, alleviating the load on your server and providing faster image loading for your readers.
It filters content but doesn’t change the info in the database.
It currently only acts on images in posts and pages, as well as featured images/post thumbnails via the image_downsize filter.
It will apply to old posts and new ones alike and can be turned on or off easily.It doesn’t really say anything about generating images or thumbnails “on the fly”.
Best regards,
IsmaelJune 18, 2019 at 5:36 pm #1111375you just need the plugin “Simple Image Sizes”, if you do not want or use some image sizes.
Just install “Simple Image Sizes”, then go to “settings” -> “media” and set the height and width to both “0” where you don’t want this image size – that’s it. No need of any code snippet or something like that.
But: this procedure cannot delete existing and not used image sizes; this is only for new image uploads!
June 20, 2019 at 6:51 am #1111820August 29, 2019 at 1:49 pm #1131873How can you recommend Simple Images Sizes when it is not compatible with the ShortPixel Image Optimizer which is one of two main choices in Enfold??? I need an alternative to Simple Image Sizes where I can turn off cropping. I found a way to change the sizes via a function but not “false or true” for cropping.
August 30, 2019 at 4:25 am #1132155Hi,
@Roine ShortPixel has clarified the compatibly question with Simple Images Sizes:The solution to this is to deactivate ShortPixel when such an image regenerate plugin is active and used. Once it has finished regenerating image, the plugin can be deactivated and ShortPixel can be activated.
In your specific case with “Simple Image Sizes”, if just have it active but you don’t use it to regenerate thumbs I’d say it would be safe to just dismiss the message.
Cropping can also be disabled with the function found in the functions.php starting on about line 168:
Please see this post for adding the function to your child theme.Best regards,
MikeMarch 17, 2021 at 11:57 am #1288702Attention to this post – the plugin simple image sizes is not updated since 2019
March 18, 2021 at 12:21 pm #1288944 -
AuthorPosts
- The topic ‘Enfold Image Sizes’ is closed to new replies.