• Anonymous User 14783633

    (@anonymized-14783633)


    There are several issues here. The first is that the plugin does not use a template to render the thumbnail images. This means that we cannot alter the output of the gallery thumbnails. Second, and this is what is a problem for us currently, is that the hardcoded HTML in the plugin is using the fullsize image as the thumbnail, instead of “shop_thumbnail”. This causes the layout of the thumbnails to be broken and causes performance to suffer, especially if there are multiple huge images being loaded on page.

    We have fixed the issue by modifying the plugin itself to use the thumbnail image correctly.

    Here is the patch:

    
    diff --git a/woocommerce-embed-videos-product-image-gallery.php b/woocommerce-embed-videos-product-image-gallery.php
    index 395e9e1..d20d848 100644
    --- a/woocommerce-embed-videos-product-image-gallery.php
    +++ b/woocommerce-embed-videos-product-image-gallery.php
    @@ -260,7 +260,10 @@ function woo_display_embed_video( $html ) {
             $loop       = 0;
             $columns    = apply_filters( 'woocommerce_product_thumbnails_columns', 3 );
             foreach ( $attachment_ids as $attachment_id ) {
    -        $newhtml .= '<div data-thumb="'.wp_get_attachment_url( $attachment_id ).'" class="woocommerce-product-gallery__image" >';
    +
    +            $full_size_image = wp_get_attachment_image_src( $attachment_id, 'full' );
    +            $thumbnail       = wp_get_attachment_image_src( $attachment_id, 'shop_thumbnail' );
    +            $newhtml .= '<div data-thumb="'.$thumbnail[0].'" class="woocommerce-product-gallery__image" >';
                 $classes = array( 'zoom' );
                 if ( $loop == 0 || $loop % $columns == 0 )
                     $classes[] = 'first';
    
Viewing 1 replies (of 1 total)
  • Thread Starter Anonymous User 14783633

    (@anonymized-14783633)

    Another issue is that the plugin files uses CRLF instead of unix newlines so we cannot even patch the plugin properly. Pretty frustrating. We are going to find or develop an alternative.

Viewing 1 replies (of 1 total)
  • The topic ‘Gallery Thumbnails rendered with Full Size images, instead of “shop_thumbnail”’ is closed to new replies.