Tagged: duplicate images
-
AuthorPosts
-
January 23, 2024 at 1:56 pm #1431785
Hi
I tried several versions of code in functions.php in child , suggested in threads dealing with this issue but I’m still seeing multiple image file versions are created. It’s a clean wp install , enfold and no plugins.-
Are these created by Enfold or WP?
How best to stop it?
Does it make sense to work with a setup that stores a single image, as uploaded, and I’ll create my own versions for any content element as needed?
If so where can I find a list of image sizes per content element?January 23, 2024 at 2:01 pm #1431789see: https://kriesi.at/support/topic/still-fighting-with-managing-default-image-sizes/#post-1418393
or: https://kriesi.at/support/topic/bilder-speicher/#post-1422743
Read the comments carefully in those snippets – some image-sizes are needed for backend to work.
January 23, 2024 at 4:13 pm #1431800Ive used this code but still many images generated
// 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; }
- This reply was modified 11 months, 1 week ago by Yory.
January 23, 2024 at 10:33 pm #1431821But : after erasing some of those image-sizes – you had to regenerate your thumbnails : there are some good plugins to do so.
f.e.: https://wordpress.org/plugins/force-regenerate-thumbnails/January 24, 2024 at 8:40 am #1431863Hi,
Thank you for the inquiry.
Have you tried regenerating the thumbnails? You can use the plugin suggested by @Guenni007 above or the plugin linked below.
// https://wordpress.org/plugins/regenerate-thumbnails/
Please make sure to create a site backup or restore point before regenerating the thumbnails just in case.
Best regards,
IsmaelJanuary 24, 2024 at 9:39 am #1431869i guess i took the plugin above because some of those tools do not remove the already existing thumbnails.
one plugin that is more clear in this is: https://en-gb.wordpress.org/plugins/regenerate-thumbnails-advanced/it has a clean-up function “Delete unused Thumbnails”
January 25, 2024 at 2:12 am #1431950Isn’t the code supposed to stop the automatic creation of multiple images some inflated in file size considerably?
these regenrate plugins will do that or will they generate more images or both?January 25, 2024 at 9:13 am #1431975The snippet above ensures that during the upload of new files, when creating the various file formats, some of the intended formats are no longer created.
This does not affect existing file formats.
For this you need these regenerate thumbnails plugins once to recalculate here and to remove file formats that no longer exist.
After recalculating you can deinstall those plugins.January 25, 2024 at 12:47 pm #1432005Of course the snippet will not delete the 1000s of files already created and the regenerate-thumbnails-advanced does not delete anything it seems although the Advanced options for Delete Unselected Thumbnails and Remove non-existent images.
what does recalculate mean? Selecting the desired file dimensions to regenerate by the plugin?
WIll this potentially contradict the snippet code that restricts regeneration of many image sizes?January 26, 2024 at 3:59 pm #1432147please try : https://wordpress.org/plugins/force-regenerate-thumbnails/ as mentioned above – i guess this is the tool to recalculate all files by erasing the existing ones.
But be carefull – if you have inserted on your content an image with an image-size that will be deleted – you then have no image in the frontend.
January 26, 2024 at 7:37 pm #1432174or as mentioned above the plugin: https://en-gb.wordpress.org/plugins/regenerate-thumbnails-advanced/
First: install the plugin. Start by deleting all calculated Image-sizes by:
Second: enter the snippet to your child-theme functions.php and
Third: go to that plugin again and recalculate the preserved image-sizes:
January 30, 2024 at 3:59 am #1432436for some reason no files are deleted by Regenerate Thumbnails Advanced
used the same plugin options
- This reply was modified 11 months ago by Yory.
January 31, 2024 at 9:06 am #1432572 -
AuthorPosts
- You must be logged in to reply to this topic.