Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
July 20, 2018 at 4:44 pm #987903
Hi
According to the code below (in enfold-child/functions.php) images in portrait orientation (vertical) should be displayed as 300 x 450 px.
Why are they displayed as only 200 x 300 px instead? How can I change this?function custom_woocommerce_gallery_thumbnail_size() { return ‘thumbnail’; } function ratio_check_by_image_size($attachment) { $img_size = ' square'; if(!empty($attachment[1]) && !empty($attachment[2])) { if($attachment[1] > $attachment[2]) //landscape { //only consider it landscape if wider than high if($attachment[1] > $attachment[2]) $img_size = 'landscape'; } else //same check with portrait { if($attachment[2] > $attachment[1]) $img_size = 'portrait'; } } return $img_size; } add_filter('woocommerce_get_image_size_thumbnail', 'woocommerce_get_image_size_thumbnail_mod', 10, 2); function woocommerce_get_image_size_thumbnail_mod($size) { global $product; $image = wp_get_attachment_image_src( $product->image_id, 'full' ); $orientation = ratio_check_by_image_size($image); if($orientation == 'portrait') { $size['width'] = 300; $size['height'] = 450; } else { $size['width'] = 450; $size['height'] = 300; } $size['crop'] = 0; return $size; }
In my active Flashlight website the following codes (custom.css) helped. In Enfold Child (styles.css) they have no effect:
.template-shop-single .product { overflow: visible; } #top .panel.entry-content { width: initial; } #top .thumbnail_container img { width: auto; margin-right: auto; margin-left: auto; } #top .thumbnail_container img { min-width: 300px; margin-right: auto; margin-left: auto; }
Thanks
Bruno- This topic was modified 6 years, 5 months ago by bruwa.
July 20, 2018 at 4:56 pm #987915ooooppppssss
Though I had refreshed the page several times (!) and also cleared the browser cache it did not work the way I expected.
Now it seems some magic happened. I changed the color scheme and when I checked the effect, the problem outlined above had disappeared …Sorry for bothering – please delete this post
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- The topic ‘Thumbnail image size’ is closed to new replies.