Yireo_Webp2
Yireo_Webp2 copied to clipboard
How to convert for all the product images?
When I disable the cache and visit the pages, the jpg
, png
to webp
conversion works fine.
But how to convert for all the products at once via CLI? Am I missing the documentation?
There is a CLI of the NextGenImages, with commands like next-gen-images:convert
. But this is more for testing and not so good for performance. If you would try to convert all images for a catalog of 10k products, then this could easily lead to 40k images. Either this would give PHP timeouts, or it would lead to the Magento bootstrap being kickstarted numerous times. Either way, PHP is not the best processing tool for this.
I would recommend to use a simple find
plus convert
(part of the Linux distro of Imagick) instead: find . -type f -name \*.jpg | while read IMAGE do; convert $IMAGE ${IMAGE/.jpg/.webp}; done
. Or something.
There is a CLI of the NextGenImages, with commands like
next-gen-images:convert
. But this is more for testing and not so good for performance. If you would try to convert all images for a catalog of 10k products, then this could easily lead to 40k images. Either this would give PHP timeouts, or it would lead to the Magento bootstrap being kickstarted numerous times. Either way, PHP is not the best processing tool for this.I would recommend to use a simple
find
plusconvert
(part of the Linux distro of Imagick) instead:find . -type f -name \*.jpg | while read IMAGE do; convert $IMAGE ${IMAGE/.jpg/.webp}; done
. Or something.
Thanks. Well noted.
What about using some cache-warmer
tool that loops over all the links from sitemap.xml
?
Such a cache warmer would simply visit the pages and if those pages would contain the WebP picture tag, while there would be source images (like WebP) in that picture tag that are not existing yet, then those source images would simply be created.