CodeIgniter Forums
output cache and webp - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: output cache and webp (/showthread.php?tid=76306)



output cache and webp - loxi_kal - 05-02-2020

Hi,

I have a question around the caching version of a page, and the webp support.

I put the caching support on my website ( $this->output->cache(300) )  but i encounter some problems with the webp support.

If the first cache was from a browser who accept the webp, of course all my images will be on this format, and the people who use for exemple an iphone 6 wish safari will not see any picture during this cache time.

My question is :  is it possible to manage a double cache version of each page, and give to the visitor the good page, or any other solution for manage this kind of thing with the cache page ?

Thanks a lot by advance


RE: output cache and webp - jreklund - 05-02-2020

Personally I would look into the <picture> html tag and include both webp and jpeg.
https://www.w3schools.com/tags/tag_picture.asp

Right know you are getting the device browser tag and serv images based on that?

Code:
<picture>
    <source srcset="/photo/image.webp" type="image/webp">
    <img src="/photo/image.jpg" alt="">
</picture>