• Resolved dav74

    (@dav74)


    Hi there,

    Can you please tell me how you update the product thumbnail sizes now, since your 3.3 update? Previously this was so well done, in image settings. Now it appears you have removed this basic functionality.

    In the Customize > WooCommerce > Product Images, there is no option for the product image thumbnails sizing (only for the category thumbnails).

    Since your latest update (3.3.2) my product image thumbnails have changed size and completely distorted. There is no height attribute anymore, so they display as squares which they should not.

Viewing 6 replies - 31 through 36 (of 36 total)
  • i ‘fixed’ it by using CSS via WordPress Display > Customize > Additional CSS and adding the following lines:

    .woocommerce ul.products li.product a img {
    width: 70px;
    height: 150px;
    display: block;
    margin: 0 0 1em;
    -webkit-box-shadow: none;
    box-shadow: none;
    }

    Adjust width and height to fit your needs.
    Probably not the best way but hey.. it works for me.

    Hello all! I have a big problem, filter for custom gallery thumbnail size not working.
    If i add this code – thumbnails become 150x150px.
    add_filter( ‘woocommerce_get_image_size_gallery_thumbnail’, function( $size ) {
    return array(
    ‘width’ => 80,
    ‘height’ => 130,
    ‘crop’ => 0,
    );
    } );
    If i add this code to class-storefront.php and delete first code, gallery thumbnails become 80×80.
    // Declare WooCommerce support.
    add_theme_support( ‘woocommerce’, apply_filters( ‘storefront_woocommerce_args’, array(
    ‘single_image_width’ => 480,
    ‘thumbnail_image_width’ => 275,
    ‘gallery_thumbnail_image_width’ => 80,
    ‘product_grid’ => array(
    ‘default_columns’ => 3,
    ‘default_rows’ => 4,
    ‘min_columns’ => 1,
    ‘max_columns’ => 6,
    ‘min_rows’ => 1
    )
    ) ) );
    Please, help me, i dont know what to do with this mega usefull thumbnails update ??

    Here is what made the thumbnails appear with the same size (200 x 300px and 300 x 200px respectively) regardless of the orientation.

    Add the following to the theme’s functions.php file:

    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 its 1.7 times 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’] = 200;
    $size[‘height’] = 300;
    } else {
    $size[‘width’] = 300;
    $size[‘height’] = 200;
    }

    $size[‘crop’] = 0;
    return $size;
    }

    I did not create this code myself and am not sure whether there really is a factor 1.7 involved as mentioned in a comment (I read “1 > 2”), but for me it works.

    I solved the issue with this code:

    //Added square images in WooCommerce Single product page

    add_theme_support( ‘woocommerce’, array(
    ‘thumbnail_image_width’ => 300,
    ‘gallery_thumbnail_image_width’ => 169,
    ‘single_image_width’ => 500,
    ) );

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

    I tried all solutions here but nothing worked.
    In the end, I disabled the “styles” plugin.
    Now all displays ok, if a little less polished looking than before.
    All my woocommerce sites were using twenty fourteen theme (with mods) and using the “fourteen styles” plugin.

    Thread Starter dav74

    (@dav74)

    @mikejolley

    Hi Mike. About 10 months ago (when I started this thread) you gave me a snippet to force WooCommerce to serve up the gallery image thumbnail as set in the WP media settings. The snippet worked perfectly.

    I have however just added “WooCommerce Additional Variation Images”, so my product variations can have separate images. My gallery thumbnails on the product variation pages have now reverted back to the large square WooCommerce format. However all my other gallery images on the standard product pages are completely fine (same as before).

    Would you be able to tell me how we can edit your original snippet (below), so it also affects the thumbnail images for the “WooCommerce Additional Variation Images”? That would be a huge help. Thanks in advance.

    add_filter( ‘woocommerce_gallery_thumbnail_size’, ‘custom_woocommerce_gallery_thumbnail_size’ );

    function custom_woocommerce_gallery_thumbnail_size() {
    return ‘thumbnail’;
    }

Viewing 6 replies - 31 through 36 (of 36 total)
  • The topic ‘Product thumbnail size not editable after last update’ is closed to new replies.