webp_image returning original source files Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
smithdesign77
Forum Members
Forum Members
Posts: 32
Joined: Mon Jan 02, 2017 10:27 pm

webp_image returning original source files

Post by smithdesign77 »

Hi!

While setting up a new gallery thingy (changes on caption and stuff), I also tried to implement WebP-images … but: It didn't work.
First I thought the path settings may have changed and manually fed an url to an image … didn't work either.

In search for a solution I stumbled upon this discussion: viewtopic.php?p=350197&hilit=webp_image#p350197
However, in my case I just simply call the very regular gallery url, which is like ...blabla.com/gallery/tag/38.html just how the gallery module generated it - no fancy JS, no delayed loading, no tweaks in the gallery module or whatsoever else I'd know of.
However, that "( $_SERVER[ 'HTTP_ACCEPT' ], 'image/webp' ) !== false)" from that discussion I just mentioned stuck with me. ???
So I copied that php-file and started commenting out all those conditions (lines 55, 75, 79, 81, 82, 83) — and NOW the magic happened! ;D

But now I'm just puzzled why - and I very much dislike the fact that there's no fallback, altho meanwhile every browser should accept WebP?
Still, not a good thing. But: WHY is this?
And I very much remember, that this very plugin HAD worked with an other page - and I just checked it and it also now serves only the original jpg-source files (all the webp-files are still in the tmp/cache/ folder tho).
So, something must've happened since whatever the latest CMSms releases or PHP update (I'm on 8.1).

Do you have any ideas?
Thanks!
User avatar
creopard
Forum Members
Forum Members
Posts: 92
Joined: Fri Nov 10, 2017 10:25 am
Location: .de
Contact:

Re: webp_image returning original source files

Post by creopard »

It could be possible that the original solution also required editing the .htaccess file like this: https://github.com/vincentorback/WebP-i ... h-htaccess

But nowadays all those checks are obsolete as all current web browsers support "webp" images, see https://caniuse.com/?search=webp
No fallback option needed, unless you still want to support Internet Explorer ;D
smithdesign77
Forum Members
Forum Members
Posts: 32
Joined: Mon Jan 02, 2017 10:27 pm

Re: webp_image returning original source files

Post by smithdesign77 »

Huh. Good point.
Well, then I'd propose updating the repository; I attached the updated file here for someone who has authority to add it. The only changes made were those I mentioned in my first post: deleting the lines 55, 75, 79, 81, 82 and 83 and adding the change info in the about-text, but without taking any credit. The code is still completely Yuris.
Thank you!
Attachments
function.webp_image.zip
(4.26 KiB) Downloaded 65 times
User avatar
creopard
Forum Members
Forum Members
Posts: 92
Joined: Fri Nov 10, 2017 10:25 am
Location: .de
Contact:

Re: webp_image returning original source files

Post by creopard »

You could also file a pull request to the original author, see:
https://github.com/wdwp/webp_image (via http://dev.cmsmadesimple.org/project/code/1480)
Post Reply

Return to “Modules/Add-Ons”