• Resolved Oliver Campion

    (@domainsupport)


    Hello,

    We are trying to optimise the images in a site by removing some of the image sizes with …

    function mpc_wp_loaded() {
    	remove_image_size('1536x1536');
    	remove_image_size('twentyseventeen-featured-image');
    	remove_image_size('twentyseventeen-thumbnail-avatar');
    	remove_image_size('shop_catalog');
    	remove_image_size('shop_single');
    	remove_image_size('shop_thumbnail');
    }
    add_action('wp_loaded', 'mpc_wp_loaded’);

    … however, when the “shop_” image sizes are removed and images are regenerated, the following happens (image is 960 x 768) …

    thumbnail: 150×150 pixels (cropped to fit) IMG_6833-Version-2-150×150.jpg
    medium: 300×300 pixels (proportionally resized to fit inside dimensions) IMG_6833-Version-2-300×240.jpg
    X medium_large: 768×0 pixels (proportionally resized to fit inside dimensions) IMG_6833-Version-2-768×614.jpg
    X large: 1024×1024 pixels (thumbnail would be larger than original)
    X 2048×2048: 2048×2048 pixels (thumbnail would be larger than original)
    X woocommerce_thumbnail: 250×200 pixels (cropped to fit) IMG_6833-Version-2-250×200.jpg
    X woocommerce_single: 768×0 pixels (proportionally resized to fit inside dimensions) IMG_6833-Version-2-768×614.jpg
    X woocommerce_gallery_thumbnail: 100×100 pixels (cropped to fit) IMG_6833-Version-2-100×100.jpg
    ws-wc_thumbnail-5-4: 660×528 pixels (cropped to fit) IMG_6833-Version-2-660×528.jpg

    … then, when the thumbnails are regenerated again it creates the missing images …

    thumbnail: 150×150 pixels (cropped to fit) IMG_6833-Version-2-150×150.jpg
    medium: 300×300 pixels (proportionally resized to fit inside dimensions) IMG_6833-Version-2-300×240.jpg
    medium_large: 768×0 pixels (proportionally resized to fit inside dimensions) IMG_6833-Version-2-768×614.jpg
    X large: 1024×1024 pixels (thumbnail would be larger than original)
    X 2048×2048: 2048×2048 pixels (thumbnail would be larger than original)
    woocommerce_thumbnail: 250×200 pixels (cropped to fit) IMG_6833-Version-2-250×200.jpg
    woocommerce_single: 768×0 pixels (proportionally resized to fit inside dimensions) IMG_6833-Version-2-768×614.jpg
    woocommerce_gallery_thumbnail: 100×100 pixels (cropped to fit) IMG_6833-Version-2-100×100.jpg
    ws-wc_thumbnail-5-4: 660×528 pixels (cropped to fit) IMG_6833-Version-2-660×528.jpg

    Preventing the removal of these image sizes prevents the issue …

    function mpc_wp_loaded() {
    	remove_image_size('1536x1536');
    	remove_image_size('twentyseventeen-featured-image');
    	remove_image_size('twentyseventeen-thumbnail-avatar');
    	// remove_image_size('shop_catalog');
    	// remove_image_size('shop_single');
    	// remove_image_size('shop_thumbnail');
    }
    add_action('wp_loaded', 'mpc_wp_loaded’);

    Please advise what’s going on here and how we can remove these image sizes without breaking the “woocommerce_” image sizes?

    Thank you,

    Oliver

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Peter Kiss (a11n)

    (@yscik8)

    Hi there!

    If I understand correctly, in WooCommerce shop_single and woocommerce_single are referring to the same size, they just changed the naming at some point.

    Do you need these image sizes? If so, don’t remove them.

    Note that WooCommerce also has it’s own regenerate functionality built-in. Also, removing image sizes would free up some storage space, but it won’t really increase performance for the end-user.

    Thread Starter Oliver Campion

    (@domainsupport)

    Hello Peter,

    Thanks for your reply.

    Can you provide more information about WooCommerce’s “own regenerate functionality”? I can’t find any documentation about it and they even recommend the use of “Regenerate Thumbnails” plugin …

    https://woocommerce.com/document/fixing-blurry-product-images/#section-4

    There’s definitely a bug here somewhere because removing the ‘shop_…’ image sizes shouldn’t prevent woocommerce_single or woocommerce_gallery_thumbnail from being generated. And then re-appear on a second pass.

    Oliver

    Plugin Author Peter Kiss (a11n)

    (@yscik8)

    Hey Oliver!

    See the ‘Update as of WooCommerce 3.3‘ section of that documentation page. It will automatically resize images on theme switch or when the sizes change AFAIK.

    As I said, the shop_single and woocommerce_single sizes are the same, and probably linked in a way that it breaks WooCommerce when shop_single is removed. Also, since they are the same size, there is no point in removing it, since it will not generate an extra file.

    Thread Starter Oliver Campion

    (@domainsupport)

    OK, thanks for the update.

    Oliver

    Hi,

    I’m trying to get the same result, I need to get rid of these 3 image size definitions:

    ‘shop_catalog’
    ‘shop_single’
    ‘shop_thumbnail’

    Anyone has any more news? If I find a way I’ll publish here.

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘“woocommerce_thumbnail” Not Regenerated after “shop_” Image Sizes Removed’ is closed to new replies.