Topic on Extension talk:WebP

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 ?"