slackero / phpwcms

Flexible, fast, powerful, customer, developer friendly web content management system and cms framework
http://www.phpwcms.org
GNU General Public License v2.0
92 stars 45 forks source link

Firefox .webp support #367

Closed tomjak closed 6 hours ago

tomjak commented 1 week ago

If the "webp_enable" setting is enabled, Chrome loads images in .web format, while Firefox loads images in .jpg format. Firefox supports the .web format. Is there a way to enable Firefox support for the Webp format?

q23 commented 1 week ago

Is this a Firefox Support Channel?

tomjak commented 1 week ago

No. I think the problem with serving .jpg files instead of .webp files is due to phpWCMS.

tomjak commented 1 week ago

Here are some more details: phpWCMS 1.10.5/1.10.6 webp_enable = 1 Firefox 115.15.0esr loads images in .webp format Edge 130.0.2849.68 loads images in .web format Chrome 130.0.6723.92 loads images in .web format Firefox 132.0.1 loads images in .jpg format

tomjak commented 1 week ago

In the file: default.inc.php line 1062 I added support for Firefox, but I'm not sure if I did it correctly: if (!empty($_SERVER['HTTP_ACCEPT']) && str_contains($_SERVER['HTTP_ACCEPT'], 'image/webp') || ($USER_AGENT && str_contains($USER_AGENT, ' Chrome/')) || ($USER_AGENT && str_contains($USER_AGENT, ' Firefox/'))) It works, please check the syntax.

slackero commented 2 days ago

I have added support for more browsers

tomjak commented 2 days ago

Excellent. Thank you.