Skip to content

Commit 41fb0ea

Browse files
committed
Fix #77700: Writing truecolor images as GIF ignores interlace flag
We revert the interlace flag related part of commit ff2822a[1], since contrary to the transparent color, the interlace flag is not retained by `gdImageCreatePaletteFromTrueColor()`. This also matches upstream libgd. [1] <http://git.php.net/?p=php-src.git;a=commit;h=ff2822a82b740edb8ccf307f080bae188c200fb9>
1 parent 0e836f5 commit 41fb0ea

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ PHP NEWS
1818
. Fixed bug #50020 (DateInterval:createDateFromString() silently fails).
1919
(Derick)
2020

21+
- GD:
22+
. Fixed bug #77700 (Writing truecolor images as GIF ignores interlace flag).
23+
(cmb)
24+
2125
- MySQLi:
2226
. Fixed bug #77597 (mysqli_fetch_field hangs scripts). (Nikita)
2327

ext/gd/libgd/gd_gif_out.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
132132
BitsPerPixel = colorstobpp(tim->colorsTotal);
133133
/* All set, let's do it. */
134134
GIFEncode(
135-
out, tim->sx, tim->sy, tim->interlace, 0, tim->transparent, BitsPerPixel,
135+
out, tim->sx, tim->sy, interlace, 0, tim->transparent, BitsPerPixel,
136136
tim->red, tim->green, tim->blue, tim);
137137
if (pim) {
138138
/* Destroy palette based temporary image. */

ext/gd/tests/bug77700.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Bug #77700 (Writing truecolor images as GIF ignores interlace flag)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('gd')) die('skip gd extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$im = imagecreatetruecolor(10, 10);
10+
imagefilledrectangle($im, 0, 0, 9, 9, imagecolorallocate($im, 255, 255, 255));
11+
imageinterlace($im, 1);
12+
imagegif($im, __DIR__ . 'bug77700.gif');
13+
14+
$im = imagecreatefromgif(__DIR__ . 'bug77700.gif');
15+
var_dump(imageinterlace($im));
16+
?>
17+
===DONE===
18+
--EXPECT--
19+
int(1)
20+
===DONE===
21+
--CLEAN--
22+
<?php
23+
unlink(__DIR__ . 'bug77700.gif');
24+
?>

0 commit comments

Comments
 (0)