14.0.0.beta3 uses GD to display webp output [Image GD] unsupported file extension. #1766

Open
opened 2026-10-05 00:55:59 +02:00 by adam · 5 comments
Owner

Hello. My piwigo 14.0.0.beta3 seems to be unable to use the GD library to display webp images. It runs on PHP8.1, and the graphics library used by piwigo is GD 2.3.3.

I see on phpinfo that GD supports webp, but after synchronizing the webp image to piwigo, I can see the image file on piwigo, but I can’t load the image. In the album, it only shows the name, and on its name “Copy image link” opens and shows a line of output “[Image GD] unsupported file extension”

The reason I use the GD library: Because the server running piwigo has very few resources and the traffic is not large, I found that Imagick occupies more resources than GD in this situation, so I chose to use the GD graphics library

I look forward to your answer, thank you!

Hello. My piwigo 14.0.0.beta3 seems to be unable to use the GD library to display webp images. It runs on PHP8.1, and the graphics library used by piwigo is GD 2.3.3. I see on phpinfo that GD supports webp, but after synchronizing the webp image to piwigo, I can see the image file on piwigo, but I can’t load the image. In the album, it only shows the name, and on its name “Copy image link” opens and shows a line of output “[Image GD] unsupported file extension” The reason I use the GD library: Because the server running piwigo has very few resources and the traffic is not large, I found that Imagick occupies more resources than GD in this situation, so I chose to use the GD graphics library I look forward to your answer, thank you! <!-- github-sync-id:1987670135 -->
Author
Owner

I admit I didn't take care of GD when I implemented WebP support.

I strongly recommend using $conf['graphics_library'] = 'ext_imagick';

I don't close this issue, because I agree that we should make Piwigo compatible with GD and WebP, if possible.

I admit I didn't take care of GD when I implemented WebP support. I strongly recommend using `$conf['graphics_library'] = 'ext_imagick';` I don't close this issue, because I agree that we should make Piwigo compatible with GD and WebP, if possible. <!-- github-comment-id:1810287342 -->
Author
Owner

I admit I didn't take care of GD when I implemented WebP support.

I strongly recommend using $conf['graphics_library'] = 'ext_imagick';

I don't close this issue, because I agree that we should make Piwigo compatible with GD and WebP, if possible.

@plegall Hello, I tried again the Imagick graphics library, but it still fills up my memory when generating thumbnails. It's not his fault, but my memory is relatively small. May I ask where I can limit his memory usage?

> I admit I didn't take care of GD when I implemented WebP support. > > I strongly recommend using `$conf['graphics_library'] = 'ext_imagick';` > > I don't close this issue, because I agree that we should make Piwigo compatible with GD and WebP, if possible. @plegall Hello, I tried again the Imagick graphics library, but it still fills up my memory when generating thumbnails. It's not his fault, but my memory is relatively small. May I ask where I can limit his memory usage? <!-- github-comment-id:2001906067 -->
Author
Owner

@ddernon I have merged your PR and it seems to work fine for basic WebP files (with or without transparency). Problem with "animated WebP":

Image
@ddernon I have merged your PR and it seems to work fine for basic WebP files (with or without transparency). Problem with "animated WebP": <img width="927" height="482" alt="Image" src="https://github.com/user-attachments/assets/a82275b4-24e9-4b4c-b985-f7c36b5b9c7e" /> <!-- github-comment-id:4451061122 -->
Author
Owner

Ah, I didn't think about those at all indeed...
Unfortunately there doesn't seem to be a way to handle that with GD - we don't even get to pick the first / a random frame to make it static:

imagecreatefromwebp() returns an image identifier representing the image obtained from the given filename. Note that animated WebP files cannot be read

https://www.php.net/manual/en/function.imagecreatefromwebp.php

So I guess the best I could do is to make these fail "more cleanly" (the same way as when there was no WebP support via GD at all), by using either this

$webp_info = pwg_image::webp_info($source_filepath);
if ($webp_info['has-animation'])

or, more simply and probably just as efficiently, by checking if $this->image is false after the read attempt at $this->image = imagecreatefromwebp($source_filepath);

Should I make another PR with that?

Ah, I didn't think about those at all indeed... Unfortunately there doesn't seem to be a way to handle that with GD - we don't even get to pick the first / a random frame to make it static: > imagecreatefromwebp() returns an image identifier representing the image obtained from the given filename. Note that animated WebP files cannot be read https://www.php.net/manual/en/function.imagecreatefromwebp.php So I guess the best I could do is to make these fail "more cleanly" (the same way as when there was no WebP support via GD at all), by using either this > $webp_info = pwg_image::webp_info($source_filepath); > if ($webp_info['has-animation']) or, more simply and probably just as efficiently, by checking if $this->image is false after the read attempt at `$this->image = imagecreatefromwebp($source_filepath);` Should I make another PR with that? <!-- github-comment-id:4451281323 -->
Author
Owner

Should I make another PR with that?

Yes please

Not all Piwigo hosting WebP files will host animated WebP, so the problem might not be that big of a deal. It's better to have a partial support with GD than nothing.

> Should I make another PR with that? Yes please Not all Piwigo hosting WebP files will host animated WebP, so the problem might not be that big of a deal. It's better to have a partial support with GD than nothing. <!-- github-comment-id:4451395346 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1766