How to resize the featured AliExpress hosted images?

wattacarp

New Member
Using the theme DavinciWoo, is there any way to resize, or get as featured image from AliExpress, a smaller size image?

In the Ali plugin settings, I've chosen not to download any image on my server, so all product images are hosted on alicdn.com. It seems that the 800x800 pixels size image is used for the featured image. This images show in a maximum size div of 300x300 pixels. They are big, consume bandwidth and slow the page load.
I think that maybe the function below (from include/woocommerce/wc-template-functions.php) is responsible but have no idea if it can be modified to use the AliExpress thumb and not the full image
Code:
    function adswth_woocommerce_template_loop_product_thumbnail() {
        $small_thumbnail_size = apply_filters( 'subcategory_archive_thumbnail_size', 'woocommerce_thumbnail' );
        $thumbnail_id = get_post_thumbnail_id();
        $image_src = wp_get_attachment_image_src( $thumbnail_id,'woocommerce_thumbnail' );
        $image_srcset = function_exists( 'wp_get_attachment_image_srcset' ) ? wp_get_attachment_image_srcset( $thumbnail_id, $small_thumbnail_size ) : false;
        $image_sizes  = function_exists( 'wp_get_attachment_image_sizes' ) ? wp_get_attachment_image_sizes( $thumbnail_id, $small_thumbnail_size ) : false;

        if(!empty($image_src)){ ?>
            <img
                data-src="<?php echo $image_src[0]?>"
                class="attachment-woocommerce_thumbnail size-woocommerce_thumbnail"
                data-srcset="<?php echo $image_srcset?>"
                sizes="<?php echo $image_sizes?>"
            />
        <?php }
    }

Besides the image size issue, I've also noticed that the AliExpress hosts .webp images, but the featured images use by AliWoo are .jpg. Is there any way to use the .webp version versions and not the .jpg? To clarify, both images exist on alicdn, for example:

https://ae01.alicdn.com/kf/S9a5ff92...ance-Quadcopter-Brushless-Motor-Mini.jpg_.jpg (this is used on the AliWoo website is as huge as 1.13MB)
https://ae01.alicdn.com/kf/S9a5ff92...nce-Quadcopter-Brushless-Motor-Mini.jpg_.webp (this is used by AliExpress on their site and is 343KB)

Any ideas?
 
Last edited:
Top