mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Add support for reading GIFs without colormap
Cf. <fc38677e80>.
Closes GH-17364.
This commit is contained in:
2
NEWS
2
NEWS
@@ -22,6 +22,8 @@ PHP NEWS
|
||||
images). (cmb)
|
||||
. Ported fix for libgd 223 (gdImageRotateGeneric() does not properly
|
||||
interpolate). (cmb)
|
||||
. Added support for reading GIFs without colormap to bundled libgd. (Andrew
|
||||
Burley, cmb)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug GH-11874 (intl causing segfault in docker images). (nielsdos)
|
||||
|
||||
@@ -244,8 +244,10 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
|
||||
BitSet(buf[8], INTERLACE), &ZeroDataBlock);
|
||||
} else {
|
||||
if (!haveGlobalColormap) {
|
||||
gdImageDestroy(im);
|
||||
return 0;
|
||||
// Still a valid gif, apply simple default palette as per spec
|
||||
ColorMap[CM_RED][1] = 0xff;
|
||||
ColorMap[CM_GREEN][1] = 0xff;
|
||||
ColorMap[CM_BLUE][1] = 0xff;
|
||||
}
|
||||
ReadImage(im, fd, width, height,
|
||||
ColorMap,
|
||||
|
||||
BIN
ext/gd/tests/gif_nocolormaps.gif
Normal file
BIN
ext/gd/tests/gif_nocolormaps.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 B |
11
ext/gd/tests/gif_nocolormaps.phpt
Normal file
11
ext/gd/tests/gif_nocolormaps.phpt
Normal file
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
A GIF without any Global or Local color tables is still decoded
|
||||
--EXTENSIONS--
|
||||
gd
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatefromgif(__DIR__ . "/gif_nocolormaps.gif");
|
||||
var_dump($im instanceof GdImage);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
Reference in New Issue
Block a user