• Resolved abstractwalls

    (@abstractwalls)


    Hi,

    I’m having a nightmare with some of the images on my site. I have long rectangular images for some products which keep cropping to 300×300 in the middle of the product.

    I want the product archive thumbnails to be square but just scaled down to fit a 300×300 square without any cropping.

    I’ve tried the following but it didn’t make a difference:

    add_filter( ‘woocommerce_get_image_size_gallery_thumbnail’, function( $size ) {
    return array(
    ‘width’ => 300,
    ‘height’ => 300,
    ‘crop’ => 0,
    );
    } );

    Also, the single product page is showing the full image. I take it this is because it’s a long narrow image so I need the same for this i.e. scaled down.

    Any help would be really appreciated.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there,

    I understand that you’d like to resize the current product thumbnails and avoid cropping.

    While the filter above should work, please note that you have to regenerate the thumbnails as well in the process. I encourage you to check this guide for now:

    https://docs.woocommerce.com/document/image-sizes-theme-developers/#section-2

    Furthemore, if the thumbnails still don’t regenerate, a plugin like this one should be good in the process. After activating it, please head to WP Admin > Settings > Media, change the sizes from there and regenerate the thumbnails.

    Please note that you may need to also flush the site’s cache.

    I hope this helps!

    Warm regards,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Stop image cropping / scale product images’ is closed to new replies.