Extension talk:WebP

About this board

AVIF source should be before WebP source

4
Summary by Octfx

Sources are added based on the transformer order.

Laoweek (talkcontribs)

Hi there, we are testing out the extension and it seems if both AVIF and WebP resources are available, WebP would be the first source element in <picture>. Because of this, AVIF source are not being used at all because if the browser is compatible with AVIF they are certainly compatible with WebP and the first source (WebP) would always be evaluated.

Is there a config I need to switch to change this behavior or is this behavior undefined at the moment? I think this is more related to PictureHtmlSupport rather than WebP extension but posting here as well for visibility.

Thank you so much for this work on the extension and thanks again for the assistance.

Octfx (talkcontribs)
119.18.0.133 (talkcontribs)

Silly me for not reading the readme carefully, thank you for the quick response.

Octfx (talkcontribs)

No worries :)

Not working with ForeignFileRepo

2
JeremiPlazas (talkcontribs)

Hi there, we're having trouble making the WebP extension work with ForeignFileRepo. Is that by design or would you point us in a direction to make it work? We're noticing CreateFromLocalFiles.php is not fetching any images provided by ForeignFileRepo. We even tried to add some random text on the File: page description to make it more "active" as a local page. No luck. Files that are uploaded locally work fine and are processed by WebP. Files brought over by ForeignFileRepo don't seem to be "seen" by it. Any clues? Thank you! Jeremi Plazas (talk) 18:41, 26 February 2024 (UTC)

Octfx (talkcontribs)

Converting foreign files locally is out of this extensions scope, sorry :/

Reply to "Not working with ForeignFileRepo"

Compatibilities of the version 2 of WebP ?

13
Nanash (talkcontribs)

Hello.

I tried to install the new version of the extension but it crashes my site (guru error blablabla varnish etc) installed in MW 1.39-rc.

So upgraded to MW 1.40 and... the extension crashed my site too. With the old version of the extension, uploading a file crashed the site, with the latest version it crashes it straight away (Guru error thingy varnish blah blah).

Now I've switched back to MW 1.39 and first version of the extension and everything's working fine again...

Any ideas that might help me ?

Octfx (talkcontribs)

Is there any way you could provide a stack trace?

I have no issues running WebP v2 on a local MW 1.40 installation with PHP Imagick v3.7.0 and libwebp installed.

Octfx (talkcontribs)
Nanash (talkcontribs)

I tried again with the develop branch and the new PictureHtmlSupport...

This time there was no crash and I was able to upload new images, but all images shown as png except some thumbnails were "broken" and in some cases clicking on the thumbnail resulted in "Error : could not load https:xxx/xxxthumbphp?image.png"...

So i tried to use script CreateFromLocalFiles.php and php CreateFromLocalFiles.php --overwiite with --wiki:mywiki... and executed mw-config but it change nothing. It generates webp images and thumbs in my ftp. But no results in my html.

I have a wikifarm with separate databases under MW 1.39-rc on an OVH shared hosting (normally with imagick and libwebp installed). I tried with MW 1/40 and it's the same.

I don't know how to generate a "stack trace" but i see no errors with the mediawiki errors messages.

Any idea ?

Allanext2 (talkcontribs)

I'm using WebP v2.0 on docker with MW 1.39 & ImageMagik with WebP support and wiki extension, but after replacing /var/www/html/includes/media/ThumbnailImage.php with /var/www/html/extensions/PictureHtmlSupport/includes/ThumbnailImage.php I get this error:

[6af1e879fe81d8b8ea5d8bf3] /index.php/User:Test TypeError: explode(): Argument #2 ($string) must be of type string, bool given

Backtrace:

from /var/www/html/extensions/WebP/includes/Hooks/ThumbnailHooks.php(131)

#0 /var/www/html/extensions/WebP/includes/Hooks/ThumbnailHooks.php(131): explode()

#1 /var/www/html/includes/HookContainer/HookContainer.php(160): MediaWiki\Extension\WebP\Hooks\ThumbnailHooks->onPictureHtmlSupportBeforeProduceHtml()

#2 /var/www/html/includes/media/ThumbnailImage.php(214): MediaWiki\HookContainer\HookContainer->run()

#3 /var/www/html/includes/Linker.php(792): ThumbnailImage->toHtml()

...

#32 {main}

Line 131 on extensions/WebP/includes/Hooks/ThumbnailHooks.php is: related to the thumbnail:

$filePath = explode( $hash, $thumbnail->getStoragePath() );

Any clue?

Octfx (talkcontribs)

Looks like you are using the master branch, could you test the develop branch?

Allanext2 (talkcontribs)

It fixed the error but I'm still not seeing webp images delivered.

I've also runned:

php extensions/WebP/maintenance/CreateFromLocalFiles.php --overwrite

php maintenance/runJobs.php

images are created in images/webp/ but not delivered, in the inspector I still see the content type as image/jpeg

Allanext2 (talkcontribs)

I'm noticing that the image is wrapped in a <picture> element and that the <source> has multiple srcset (none in webp).

I don't have the header check for webp.. this is the configuration:

$wgWebPEnableConvertOnUpload = true;

$wgWebPEnableConvertOnTransform = true;

# $wgWebPEnableResponsiveVersionJobs = true;

# $wgWebPCheckAcceptHeader = false;

$wgWebPCompressionQuality = 75;

$wgWebPCompressionQualityAvif = 75;

$wgWebPFilterStrength = 80;

$wgWebPAutoFilter = true;

# $wgWebPThumbSizes = [120, 320, 800, 1200, 1600];

$wgEnabledTransformers = [

"MediaWiki\\Extension\\WebP\\Transformer\\WebPTransformer"

#"MediaWiki\\Extension\\WebP\\Transformer\\AvifTransformer",

];

$wgWebPCWebPLocation = "/usr/bin/cwebp";

# $wgWebPAvifencLocation = /usr/bin/avifenc;

Allanext2 (talkcontribs)

Chrome, Firefox and Safari are up to date to the latest version

Allanext2 (talkcontribs)

The webp images are created also under images/thumb/webp/ with all the thumbnails versions

Allanext2 (talkcontribs)
Allanext2 (talkcontribs)

@Octfx where would you look in the code? I can debug a bit. Thank you

Allanext2 (talkcontribs)

@Octfx in the file ./extensions/WebP/includes/Hooks/ThumbnailHooks.php

in the function:

public function onPictureHtmlSupportBeforeProduceHtml( ThumbnailImage $thumbnail, array &$sources ): void {

the first if the $thumbnail->getStoragePath() is false/null so it comes out of the function right away

Reply to "Compatibilities of the version 2 of WebP ?"

Endless Jobs are created

2
2001:8F8:1D50:799D:C9F1:8CB3:308:8118 (talkcontribs)

Each time I execute the script runJobs.php maintenance script in MediaWiki 1.40.1, I encounter numerous jobs associated with these extensions. Despite the completion of these jobs, they persistently reappear in the queue.

Octfx (talkcontribs)

This is expected when $wgWebPEnableResponsiveVersionJobs is true (default).

Jobs are generated when a thumbnail is output on the site. These jobs are however null jobs if the respective thumbnails exists, so no new thumb will be generated and the job does nothing.

Reply to "Endless Jobs are created"

Soon compatible with an image viewer ?

4
Nanash (talkcontribs)

Great extension. It remains to make it compatible with an image viewer... I hope it will happen ^^

Octfx (talkcontribs)

Can you link the extension you are referring to? :)

If you are talking about multi media viewer,you'll need to activate Manual:Thumb.php

Nanash (talkcontribs)

I still use FancyBoxThumbs. Abandoned extension but still functional. And I prefer its simplicity. MMV is too "graphically heavy" for my taste.

But if you tell me that WebP is compatible with MMV by playing with Manual:Thumb.php, I will see that and consider it if it is functional on my installation.

Nanash (talkcontribs)

You were right. It works perfectly with MMV, I just forgot about this Thumb.php thing. It doesn't work with FBT though.

Well, that's it. I liked FBT so much but I think it's time for me to finally adopt MMV. I don't like it too much but being able to use your extension is worth it.

Congratulations on your work anyway and thank you.


(N.B. : If someone comes along and wants to take over the development of FancyBoxThumbs, that would be great. Having a graphically and technically lighter alternative to MMV would be a good thing for the wiki community)

Incompatible with Extension:PageImages ?

1
Summary by Nanash

found the bug with my installation ^^

Nanash (talkcontribs)

Other question... Extension works fine. Huge advantage for the speed of loading the pages.

But since then, no more images recognized by Extension:PageImages... Seems the extension does not recognize the webp format. Do you known a solution at this time ?

There are no older topics