• Resolved manualsnow

    (@manualsnow)


    Hello,

    This is a very nice plugin. Is it possible to support image thumbnails, especially in WooCommerce? Why is it a problem? When using EXMAGE (external images), it loads the full size file even for galleries, thumbmails, etc. There can be 2, 4, 10 images per product, so server load and page size is increased a lot.

    WooCommerce automatically creates resized images, like so:

    For example, if your image is called product-123-photo.jpg, it will create product-123-photo-50×50.jpg and product-123-photo-100×100.jpg and product-123-photo-600×600.jpg in the same folder and load the (much smaller) images on the page, instead of the original (full size) file. The image below is 1600x1600px original, but WooCommerce uses smaller sizes on the product page:

    Is it possible to add support for thumbnails? We will generate the resized files on the external server, but how to get EXMAGE to use them instead of full-size images?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi, Unfortunately, our plugin is unable to implement this feature.

    Best regards.

    Hello,

    In fact, the 100*100 size is supported at the moment. At the time of import, if your image is product-123-photo.jpg and an image size product-123-photo.jpg_100x100.jpg exists, it will also be imported.

    Currently supported sizes are hardcoded as:

    array(
    'thumbnail' => 50,
    'small1' => 100,
    'small2' => 200,
    'medium' => 350,
    'medium_large' => 640
    )

    However, we can add a filter hook there for customization purpose in the following updates.

    Best regards

    Thread Starter manualsnow

    (@manualsnow)

    Existing support for thumbnails is good news. In my testing, it didn’t work, unfortunately, I provided an URL where the thumbnails were already generated, but EXMAGE didn’t pick it up, it just listed all sizes as original file.

    However, inspecting the database, if I edit _wp_attachment_metadata in postmeta table related to the image, and change woocommerce_gallery_thumbnail value from product-123-photo.jpg to product-123-photo-100×100.jpg, then WooCommerce picks it up just fine.

    So, for now, I can just run SQL search / replace code to address this issue, and hopefully, you will release a newer version that does it automatically.

    Thank you for releasing such a useful plugin!

    A new versions has just been released, please update it then add below PHP snippet:

    add_filter( 'exmage_get_supported_image_sizes', function ( $image_sizes, $url ) {
    
    	return array(
    		'thumbnail'    => 200,
    		'medium'       => 350,
    		'medium_large' => 640,
    	);
    }, 10, 2 );

    You should also add some condition checks to make sure the $url is from your desired source.

    Thread Starter manualsnow

    (@manualsnow)

    Another comment, I noticed in the database, there are identical values (image file URL) for:

    _wp_attached_file
    and
    _exmage_external_url

    Is there a need for _exmage_external_url entry then? It means the wp_postmeta database table will be bigger, and with a lot of images, it could become an issue.

    Thread Starter manualsnow

    (@manualsnow)

    A new version has just been released, please update it then add below PHP snippet:

    Yes, the code you provided works for WordPress posts and pages, thank you! For WooCommerce it probably needs to be:

    add_filter( 'exmage_get_supported_image_sizes', function ( $image_sizes, $url ) {
    
    	return array(
    	'woocommerce_gallery_thumbnail'    => 100,
    	'woocommerce_thumbnail'            => 350,
    	'woocommerce_single'               => 640,
    	);
    }, 10, 2 );

    Just need to adjust the sizes, in pixels, to match your theme (ex. 100, 350, 640)

    Yes, you can adjust the sizes to fit your need.

    Is there a need for _exmage_external_url entry then? It means the wp_postmeta database table will be bigger, and with a lot of images, it could become an issue.

    Yes, it’s needed for our plugin to detect and treat an image as an external source.

    Thread Starter manualsnow

    (@manualsnow)

    Just to confirm, I looked at the database again and seeing that each image has 2 identical records when using EXMAGE. Is this right or should there only be 1 record (maybe 2 if it’s a duplicate)?

    Please advise.

    Yes, but they are used for different purposes. _exmage_external_url can just be boolean but we want to store the original url so that it’s possible to switch between external image and local image like this https://snipboard.io/Vx03u6.jpg

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘EXMAGE support for thumbnails’ is closed to new replies.