From:             swbrown at ucsd dot edu
Operating system: any
PHP version:      4.3.1
PHP Bug Type:     GD related
Bug description:  truecolor transparent png bug in PHP's bundled libgd but not in the 
real gd

PHP's bundled gd doesn't properly handle transparent truecolor pngs.  At
the time it bundled gd, neither did gd, but 2.0.11 handles it now.  Some
of the files in PHP's libgd report having been updated to 2.0.11 (gd.c,
revision 1.41), but either the update wasn't successful or not all of the
files have been updated yet.  I tested this with 4.3.1 and swapping in
php4/php5 CVS head's libgd as well - same problem.  It works when linking
to a real gd 2.0.11 install.  I'm adding this as a bug so it'll be easier
to keep track of this problem.

Here's a test case that will show the problem.  Note that if you use IE on
win32 to view the result, it'll look like it failed even if it didn't, as
win32 IE has its own issues with truecolor transparent pngs.

<?php

// Example demonstrating a transparent truecolor png bug
// fixed by the time of gd 2.0.11, but not fixed in php's
// bundled gd.

header("Content-type: image/png");

$image = imageCreateTruecolor(640, 100);

$transparent = imageColorAllocate($image, 0, 0, 0);
$red = imageColorAllocate($image, 255, 50, 50);
imageColorTransparent($image, $transparent);

imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent);

imageString($image, 3, 0, 0, "If the background is black, and you aren't
on win32 IE (buggy png code), this is a bug.", $red);

imagePng($image);

?>

-- 
Edit bug report at http://bugs.php.net/?id=22544&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22544&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22544&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22544&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22544&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22544&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22544&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22544&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22544&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22544&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22544&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22544&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22544&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22544&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22544&r=gnused

Reply via email to