Serve Images in Next-Gen Formats
As you automatically crop / resize etc images as they are uploaded - would there be the ability to deliver WebP versions (or similar)?
Yea, but we'd need to support legacy formats as well. Can you let me know how you want to implement it in a page and benefits? (the why)?
In general I think I'd like to build/find a separate image thumbnailer/processor. Let me know some more details on what you want to do.
I guess I would see it working that every standard image created from the upload (original + thumbs + crops) would have 2 versions - the original format plus the WebP. Then allow the browser to choose which image format to use.
So, the code generator would output the various different images as usual, ut with the alternates as well.
I would use something like the following in the page code:
<?php foreach ($record['thumbnail'] as $index => $upload): ?>
<source srcset="<?php echo htmlencode($upload['urlPath_webp']) ?>" type="image/webp">
<source srcset="<?php echo htmlencode($upload['urlPath_jpg']) ?>" type="image/jpeg">
<img src="<?php echo htmlencode($upload['urlPath_jpg']) ?>" alt="Alt Text!">
<?php endforeach ?>
Here's a good summary of benefits and use: https://css-tricks.com/using-webp-images/
There's a neat library here that dynamically redirects .png/jpg image urls for supporting browsers and generates .webp images:
We couldn't potentially build something as well.