cvs: php-src /ext/gd/libgd gd.c /ext/gd/tests bug39273.phpt
| From: | Pierre-Alain Joye | Date: | Sat, 04 Nov 2006 02:23:45 +0000 |
| Subject: | cvs: php-src /ext/gd/libgd gd.c /ext/gd/tests bug39273.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-41342@lists.php.net to get a copy of this message | ||
pajoye Sat Nov 4 02:23:45 2006 UTC
Modified files:
/php-src/ext/gd/libgd gd.c
/php-src/ext/gd/tests bug39273.phpt
Log:
- MFB: #39273, imagecopyresized and alpha channel
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.95&r2=1.96&diff_format=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.95 php-src/ext/gd/libgd/gd.c:1.96
--- php-src/ext/gd/libgd/gd.c:1.95 Thu Sep 28 08:52:23 2006
+++ php-src/ext/gd/libgd/gd.c Sat Nov 4 02:23:45 2006
@@ -754,7 +754,7 @@
int p = gdImageGetPixel(im, x, y);
if (!im->trueColor) {
- return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p)
? gdAlphaTransparent : gdAlphaOpaque);
+ return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p)
? gdAlphaTransparent : im->alpha[p]);
} else {
return p;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug39273.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/gd/tests/bug39273.phpt
diff -u /dev/null php-src/ext/gd/tests/bug39273.phpt:1.2
--- /dev/null Sat Nov 4 02:23:45 2006
+++ php-src/ext/gd/tests/bug39273.phpt Sat Nov 4 02:23:45 2006
@@ -0,0 +1,32 @@
+--TEST--
+Bug #37360 (gdimagecreatefromgif, bad image sizes)
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+ if (!GD_BUNDLED) die('skip external GD libraries always fail');
+?>
+--FILE--
+<?php
+$small = imagecreatetruecolor(10, 10);
+$c1 = imagecolorallocatealpha($small, 255,0,0,50);
+imagecolortransparent($small, 0);
+imagealphablending($small, 0);
+imagefilledrectangle($small, 0,0, 6,6, $c1);
+
+$width = 300;
+$height = 300;
+$srcw = imagesx($small);
+$srch = imagesy($small);
+
+$img = imagecreatetruecolor($width, $height);
+
+imagecolortransparent($img, 0);
+imagealphablending($img, false);
+imagecopyresized($img, $small, 0,0, 0,0, $width, $height, $srcw, $srch);
+imagesavealpha($img, 1);
+
+$c = imagecolorat($img, 0,0);
+printf("%X", $c);
+?>
+--EXPECTF--
+32FF0000