|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65038 IMAGETYPE_WEBP constant missing
Submitted: 2013-06-14 10:20 UTC Modified: 2016-11-18 10:10 UTC
Avg. Score:4.5 ± 0.7
Reproduced:13 of 14 (92.9%)
Same Version:4 (30.8%)
Same OS:1 (7.7%)
From: david at admin dot amateri dot cz Assigned: cmb (profile)
Status: Closed Package: GetImageSize related
PHP Version: 5.5.0RC3 OS: CentOS 6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
25 - 16 = ?
Subscribe to this entry?

 [2013-06-14 10:20 UTC] david at admin dot amateri dot cz
There is no IMAGETYPE_WEBP constant returning from exif_imagetype, but there is webp support since v5.5. You should add it. Thank you.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-03 14:43 UTC] enumag at gmail dot com
Also webp should be supported by getimagesize, getimagesizefromstring, image_type_to_extension and image_type_to_mime_type.
 [2016-01-15 12:15 UTC] benjamin dot morel at gmail dot com
+1 for WEBP support in getimagesize(), please!

WEBP is becoming increasingly popular, and getimagesize() is so handy to get image information without having to load the whole file using Imagick, for example.
 [2016-06-10 08:13 UTC] archon810 at gmail dot com
I just spent an hour trying to figure out why webp isn't working in getimagesize only to eventually arrive at this bug. Please add support for it.
 [2016-08-03 03:47 UTC]
-Package: EXIF related +Package: GetImageSize related
 [2016-08-03 03:47 UTC]
Changing the category here to be "GetImageSize" as internally exif_imagetype() re-uses an internal function we use for GetImageSize(), and exposes it to userland, despite not having anything exif related code in it.
 [2016-09-28 07:44 UTC] sebreghts dot jelle at gmail dot com
This bug report is over 3 years old and webp is gaining traction ( Is there any progress on this issue?
 [2016-10-06 17:30 UTC]
-Assigned To: +Assigned To: cmb
 [2016-10-07 22:33 UTC]
-Status: Assigned +Status: Closed
 [2016-10-07 22:33 UTC]
Implemented with <;a=commit;h=14d4ee93>.
 [2016-10-08 04:56 UTC] enumag at gmail dot com
Why ignore lossless webp? Can you open a new issue about that with an explanation?

Also what exactly does it mean that only lossy webp is supported? Does it mean that if I call getimagesize on a lossless webp it won't return the needed info?
 [2016-10-08 07:32 UTC]
-Status: Closed +Status: Re-Opened
 [2016-10-08 07:32 UTC]
> Does it mean that if I call getimagesize on a lossless webp it
> won't return the needed info?

Indeed, getimagesize() would return FALSE in this case.

Actually, I thought that lossless WebP isn't very common and that
it wouldn't be supported by libgd, but at least the latter
assumption was wrong – imagecreatefromwebp() is able to read
lossless WebP (at least the simple format without alpha; haven't
yet checked further). So it makes sense to add support for simple
lossless WebP (VP8L) to getimagesize() and friends.
 [2016-10-08 08:55 UTC]
-Status: Re-Opened +Status: Closed
 [2016-10-08 08:55 UTC]
VP8L support implemented with <;a=commit;h=59cd8eb7>.
 [2016-10-08 09:39 UTC] enumag at gmail dot com
Very nice! :-)

Now is there a reason not to implement VP8X as well? It seems that the "Canvas Width Minus One" and "Canvas Height Minus One" are always at the same position so it should be easy.

Of course it depends on whether imagecreatefromwebp supports VP8X or not.
 [2016-10-08 11:33 UTC]
-Status: Closed +Status: Re-Opened
 [2016-10-08 11:33 UTC]
> Of course it depends on whether imagecreatefromwebp supports
> VP8X or not.

Not necessarily; for instance, getimagesize() supports BMP, but
GD still doesn't.

Anyhow, as I've just learned imagecreatefromwebp() does support
VP8X (even stored color profiles are applied), so it makes indeed
sense to add support for VP8X to getimagesize().
 [2016-10-08 13:15 UTC]
-Status: Re-Opened +Status: Closed
 [2016-10-08 13:15 UTC]
VP8X support added with commit <;a=commit;h=1d977e55>.
 [2016-11-17 22:57 UTC] bluespire at gmail dot com
Is there any chance this patch would be accepted into the 5.6 branch?

Not all of us are able to move directly to 7.1 to take advantage of this, and other webp supporting functions like imagecreatewebp are in 5.5+
 [2016-11-18 10:10 UTC]
> Is there any chance this patch would be accepted into the 5.6
> branch?

This ticket had been rightly filed as feature request, and we
usually don't add new features to stable branches for QA reasons.
Note also that active support for PHP 5.6 ends in about 6 weeks,
so it's rather unlikely that this patch will be backported to 5.6.

If you really have to stick with PHP 5.6 for now, consider a
userland implementation. If you only have to detect whether a file
is in WebP format, it should be sufficient to check whether the
first three bytes of the file are `VP8`.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 17:01:36 2024 UTC