yireo / Yireo_Webp2

Magento 2 module to add WebP support to Magento 2
Open Software License 3.0
195 stars 57 forks source link

Magento Pagebuilder -> Support Mobile Images #107

Open duffner opened 2 years ago

duffner commented 2 years ago

Today, this module only supports the primary image used within Magento's pagebuilder module. If an alternate Mobile Image is added, the module ignores this image, and WebP is not applied.

I believe this to be mostly a bug, as it works correctly in other situations, but a slight feature request as it doesn't appear to be supported today.

jissereitsma commented 2 years ago

I don't know about this feature and don't have the time to aim for compatibility with specific features. Instead, let's make this technical. This WebP extension is not intended to work with PageBuilder, and it works. Why? Because PageBuilder generates img tags. So it's not PageBuilder that needs to be supported, but HTML. What kind of HTML are you talking about?

tsfanning21 commented 2 years ago

i just wanted to follow up that this is still an issue.

The issue isn't specifically with pagebuilder but the additional option for a mobile version of every image.

image

What then ends up happening is a complex path ends up getting passed into the webp converter, which correctly throws an exception because that path doesn't exist in the cache.

[2022-06-28 13:20:00] main.ERROR: Source cached image does not exists https://www.wholesalecabinets.us/media/wysiwyg/wholesale-cabinets-independence-day-sale-2022.jpg\",\"mobile_image\":\"https://www.wholesalecabinets.us/media/wysiwyg/wholesale-cabinets-independence-day-sale-2022-mobile.jpg {"exception":"[object] (Yireo\NextGenImages\Exception\ConvertorException(code: 0): Source cached image does not exists https://www.wholesalecabinets.us/media/wysiwyg/wholesale-cabinets-independence-day-sale-2022.jpg\\",\\"mobile_image\\":\\"https://www.wholesalecabinets.us/media/wysiwyg/wholesale-cabinets-independence-day-sale-2022-mobile.jpg at /chroot/home/wholesal/wholesalecabinets.us/html/vendor/yireo/magento2-webp2/Convertor/Convertor.php:138)"} []

I'm thinking the best way to handle this is look for the pattern and convert them both.