• I have all of the images on my site delivered as webp and it works fine, but I would like to exclude the images from my shop on the single product pages. The reason is because since the images get wrapped in a picture tag, it messes with the functionality of a WooCommerce gallery plugin I installed (WooSwipe). So, basically, I would like to remove the picture tags from the images from only the single product pages and just deliver those as regular jpegs.

    Is this something that is possible? I read through the doc and noticed there is something called ‘exclude patterns’ but I’m not sure how I would apply it to my case.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author ShortPixel

    (@shortpixel)

    Hi and thanks for using ShortPixel!
    There is no setting to exclude the images just from being replaced with WebP based on a pattern/css class, but we might add that if it gains traction. ?? I added it to our possible future enhancements.

    In the meantime order to make the WooCommerce not use the <picture> tag you could use the following approaches:
    1. if the images which appear in Woo have a particular name convention ( let’s say they all start with “myWoo_” ) you could use the Exclude Patterns setting ( input name:myWoo_into that settings field ). The downside is that they won’t be optimized either.
    2. just optimize them with the WebP setting off. This will not generate the WebP and thus make the plugin not replace the with <picture>. The downside is that if the image appears in other places too, it will appear as .png/.jpg there too.

    You could also fix the problem by still delivering WebP but without the picture tag:
    1. Use the .htaccess approach which delivers the WebP transparently using the same URL. You need to make sure you’re not using a CDN though. If you use Nginx you can configure it by hand like it’s described here: https://shortpixel.helpscoutdocs.com/article/111-configure-nginx-to-transparently-serve-webp-files-when-supported
    2. use ShortPixel Adaptive Images plugin, which will use lazy-loading to deliver a WebP picture instead of the original format, will adapt the images size to the exact needed screen size for that device, will serve the images from our CDN but this product has a different approach, you can read more here: https://shortpixel.helpscoutdocs.com/article/179-shortpixel-adaptive-images-vs-shortpixel-image-optimizer.

    Best regards,
    The ShortPixel team.

    Thread Starter The Shopkeeper

    (@cpkid1)

    Thanks for the reply!

    2. just optimize them with the WebP setting off. This will not generate the WebP and thus make the plugin not replace the with <picture>. The downside is that if the image appears in other places too, it will appear as .png/.jpg there too.

    Are you saying there is a way to exclude only certain images from the media folder from being optimized as WebP? If so, where do I go to do this?

    Plugin Author ShortPixel

    (@shortpixel)

    You need to go to ShortPixel’s Advanced settings, deactivate the WebP option, optimize the images you display in WooSwipe (first restore them if they were already optimized) and then re-enable the WebP option.
    Please let me know if that worked. If not, please contact us on our support channel in order to be able to get share more details: https://shortpixel.com/contact

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Don’t deliver certain images as webp?’ is closed to new replies.