5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 28   (RSS)

Hey Tim, 

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.

Thanks!

Dave Edis - Senior Developer
interactivetools.com

Hi Dave.

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): ?>

<picture>
<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!">
</picture>

<?php endforeach ?>

Here's a good summary of benefits and use: https://css-tricks.com/using-webp-images/ 

Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au

Hey Tim, 

There's a neat library here that dynamically redirects .png/jpg image urls for supporting browsers and generates .webp images:
https://github.com/rosell-dk/webp-convert/blob/master/docs/webp-on-demand/webp-on-demand.md

We couldn't potentially build something as well.  

Dave Edis - Senior Developer
interactivetools.com

That certainly looks easier to implement on my side :)

Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au