How to prevent Woocommerce Gallery Thumbnail from being stretched?
-
Hi,
How do I prevent my Woocommerce_gallery_thumbnail image to not be stretched out?
I have added the below to my child functions.php file:
add_filter( ‘woocommerce_get_image_size_gallery_thumbnail’, function( $size ) {
return array(
‘width’ => 100,
‘height’ => 100,
‘crop’ => 0,
);
} );I have regenerated thumbnails and know that my image is 100×48 so fits within the above dimension.
However, regardless of what theme I use, the image appears stretched out.
Please see screenshot link for what I am talking about.
https://snipboard.io/oWOF9v.jpg
It looks like my thumbnail is being stretched to fill in the 100×100 space even though the image is only 100×48.
I am using a variation swatch plugin but this seems to happen with a number of plugins that I’ve tested. I am also using the Storefront theme so I don’t think the theme makes a difference. I can also verify that the right image is being displayed (by checking the link).
Is there a way to force Woocommerce to just display the image “as is” since I know it fits?
Thanks!
- The topic ‘How to prevent Woocommerce Gallery Thumbnail from being stretched?’ is closed to new replies.