Archived topic
Woocommerce 3.3+ thumbnail issues
6 replies · Started by Vanessa on November 18, 2018
Since Woocommerce 3.3 release my website has an issue with the thumbnails used for the additional product images.
Woocommerce 3.2.x used 3 different image size settings inside Woocommerce for images including a thumbnail size. This worked fine to my recollection (single, catalog, and thumbnail or something similar).
Now in Woocommerce 3.3+ you have only 2 image size controls under Customizer, main image width (image size used for the main image on single product pages) and thumbnail is supposedly used for both catalog page image and thumbnail image. Their reasoning being you probably have the catalog image cached already, so why download it again? (This breaks sites for people who used different image aspect ratios for catalog and thumbnail, but Woocommerce devs don't seem to care much).
Except, with GeneratePress, it isn't. My Settings in Customizer is 600 image width, 600 thumbnail width. My thumbnail remains stubbornly at 100x100 pixels, no matter what I set in Customizer.
When I edit my image and select "generate thumbnails" I find this:
thumbnail: 300×300 pixels (cropped to fit) KN5B0W510_zoom-3-300x300.jpg
medium: 600×600 pixels (proportionally resized to fit inside dimensions) KN5B0W510_zoom-3-600x600.jpg
medium_large: 768×0 pixels (proportionally resized to fit inside dimensions) KN5B0W510_zoom-3-768x768.jpg
large: 1024×1024 pixels (thumbnail would be larger than original)
woocommerce_thumbnail: 600×600 pixels (cropped to fit) KN5B0W510_zoom-3-600x600.jpg
woocommerce_single: 600×0 pixels (proportionally resized to fit inside dimensions) KN5B0W510_zoom-3-600x600.jpg
woocommerce_gallery_thumbnail: 100×100 pixels (cropped to fit) KN5B0W510_zoom-3-100x100.jpg
shop_catalog: 600×600 pixels (cropped to fit) KN5B0W510_zoom-3-600x600.jpg
shop_single: 600×0 pixels (proportionally resized to fit inside dimensions) KN5B0W510_zoom-3-600x600.jpg
shop_thumbnail: 100×100 pixels (cropped to fit) KN5B0W510_zoom-3-100x100.jpg
The attachment says it also has these thumbnail sizes but they are no longer in use by WordPress. You can probably safely have this plugin delete them, especially if you have this plugin update any posts that make use of this attachment.
thumbnail_old_150x150: 150×150 pixels KN5B0W510_zoom-3-150x150.jpg
thumbnails_twist: 120×120 pixels KN5B0W510_zoom-3-120x120.jpg
So it seems like Generatepress is using thumbnail 'woocommerce_gallery_thumbnail' for the additional product image thumbnails instead of using 'woocommerce_thumbnail' and scaling down to fit using CSS as suggested by Woocommerce devs.
The upshot is, my thumbnails are now too low resolution and look UGLY scaled up using CSS from 100x100px and I can't make woocommerce_gallery_thumbnail back to a higher resolution as the interface to change it is gone from Woocommerce setting page.
Would appreciate it if this could be fixed :)
https://github.com/woocommerce/woocommerce/wiki/Thumbnail-Image-Regeneration-in-3.3
Hi there,
I'm not sure I understand? GP itself doesn't alter the WooCommerce images in any way - all of that is handled by WooCommerce itself.
On which page is your site using 100x100 images?
Sorry Tom, it looks like I need to research my issue some more. The Woocommerce docs don't seem to match what I'm seeing.
Okay, I've identified the problem and fixed it using a child theme.
My issue is that the gallery images thumbnails (the little thumbnails that show extra images in a strip below the main image on a single product page) appear to default to 100 x 100 pixels, UNLESS the theme declares a different value, which Generatepress doesn't do.
Using Generatepress theme, I can see in Chrome Inspector that the container for these images is an ordered list:
<ol class="flex-control-nav flex-control-thumbs"><li><img src="https://kidsinthekitchen.nz/wp-content/uploads/2018/11/KN5B0W511_zoom-100x100.jpg" class="flex-active" draggable="false" scale="0"></li><li><img src="https://kidsinthekitchen.nz/wp-content/uploads/2018/11/UK091-2T-100x100.jpg" draggable="false" scale="0"></li><li><img src="https://kidsinthekitchen.nz/wp-content/uploads/2018/11/UK091-3T-100x100.jpg" draggable="false" scale="0"></li><li><img src="https://kidsinthekitchen.nz/wp-content/uploads/2018/11/UK091-6T-100x100.jpg" draggable="false" scale="0"></li></ol>
The height of this list element (on my high dpi screen at least) is shown in Chrome inspector as 115.438px which means that the default 100x100 thumbnail size is too small; therefore the image is being scaled up to fit and hence looks awful.
This is something I noticed when creating the site a year ago. Back then I simply edited the gallery thumbnail size in Woocommerce settings to a larger value until it looked sharp. This control was removed in Woocommerce 3.3+ (it seems to be their position its now up to the theme developer to choose a size which fits their theme).
As stated above, according to Woocommerce docs a theme author can declare a size for the gallery thumbnail which best suits their theme.
However, this doesn't return control of the thumbnail size to me, the shop owner, without editing the theme, as Customiser won't allow me to change that setting.
So instead I created a child theme and added just this to functions.php:
add_filter( 'woocommerce_gallery_thumbnail_size', 'custom_woocommerce_gallery_thumbnail_size' );
function custom_woocommerce_gallery_thumbnail_size() {
return 'thumbnail';
}
This makes the theme use the "thumbnail" picture size for "woocommerce_gallery_thumbnail_size" - "thumbnail" being the default Wordpress thumbnail size set in Settings - Media.
This means I can tweak the thumbnail size larger myself there until it looks nice.
I'd be interested to see if this is specific to my browser/screen/shop or the same for all Woocommerce sites using this theme?
Interesting - thanks so much for reporting this.
GPP 1.8 will be centered around WooCommerce, so we'll absolutely look at applying this by default.
Hi guys, did you ever fix this, I have the exact same issue with thumbs showing as 100px. I tried the snippet from Vanessa but it did not work for me. However, if I use the following snippet it shows the images at 300px.
add_filter( 'woocommerce_get_image_size_gallery_thumbnail', function( $size ) {
return array(
'width' => 300,
'height' => 300,
'crop' => 0,
);
} );
The really strange thing is that it does not matter what image I set for width/height, it straight away displays images as 300px. If I regen thumbs, it will regen the new size if I set a custom size with the above.
When I test Storefront or 2022 theme, they both display thumbs at 150px, so looks like GP could be setting it somewhere? Any thoughts?
If I use the following snippet, I can use the "medium" image size set in the wordpress media settings, which is what I am doing for now.
add_filter( 'woocommerce_gallery_thumbnail_size', function( $size ) {
return 'medium';
} );
thanks
Hi Sam,
Please open a new topic for your question.
This topic is from 2018 so I'd assume it's not the theme issue.
Thanks!