php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23482 Wrong value returned from imageColorTransparent()
Submitted: 2003-05-04 18:24 UTC Modified: 2003-06-02 23:21 UTC
From: author at ninelivescomic dot com Assigned:
Status: Closed Package: GD related
PHP Version: 4.3.1 OS: Linux 2.4.20
Private report: No CVE-ID: None
 [2003-05-04 18:24 UTC] author at ninelivescomic dot com
Hi, I'm using php to return the color of a 4-bit png image with binary transparency. This code:
/* begin php code */
$imgBase= imageCreateFromPNG("20030429a.png");
print(imageColorTransparent($imgBase));
/* end php code */
prints -1, which I assume means "no transparent color". I'm sure there IS a transparant color in the image. I've tried this with both an optimized and non-optimized palette, same results. I'm using gd library 1.6.2, and can send the image if that helps.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-04 19:04 UTC] author at ninelivescomic dot com
Hi, I'm using php to return the transparent color of a 4-bit png image with binary transparency. This code:
/* begin php code */
$imgBase= imageCreateFromPNG("20030429a.png");
print(imageColorTransparent($imgBase));
/* end php code */
prints -1, which I assume means "no transparent color". I'm sure there IS a transparent color. I've tried this with both an optimized and non-optimized palette, same results. I'm using gd library 1.6.2, and can send the image if it helps.
 [2003-05-05 01:34 UTC] derick@php.net
GD 1.6 doesn't support transparency, so that's the problem. Compile PHP with --with-gd (and nothing else behind it) and it will use the internal bundled GD which supports true color images and transparency.
 [2003-05-13 06:23 UTC] author at ninelivescomic dot com
Recompiled php, using gd bundled (2.0 compatible). This code:
<?php
$imgStrip= imageCreateFromPNG("20030509.png");
header("Content-type: image/png");
imagePNG($imgStrip);
imageDestroy($imgStrip);
?>
Displays the image without the transparency, even though I know it has it. Displaying imageing <IMG> tag looks fine.
 [2003-05-15 13:08 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

And we also need that exact same picture you're trying with..

 [2003-05-20 12:33 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-05-20 19:06 UTC] author at ninelivescomic dot com
Sorry for the delay. I'm using php on a shared host environment so shuffling around and recompiling different versions is a bit problematic. I'd like to exhaust other possibilities first. Where should I send the picture and source code?
 [2003-05-20 19:17 UTC] iliaa@php.net
Send them to iliaa@php.net
 [2003-05-22 11:45 UTC] author at ninelivescomic dot com
Items sent. Here's a copy if you need it:

test.html:
<html>
<body bgcolor= "#ffffcc">
<p>Using &lt;img src="test.php" /&gt;:<br />
<img src="test.php" /></p>
<p>Using &lt;img src="test.png" /&gt;:<br />
<img src="test.png" /></p>
</body></html>

test.php:
<?php
$gdTest= imageCreateFromPNG("test.png");
header("Content-type: image/png");
imagePNG($gdTest);
imageDestroy($gdTest);
?>

test.png was copied directly from http://static.php.net/www.php.net/images/logos/php-med-trans.png. Running test.html shows the same picture, one with transparency on, one with it off.

Thanks for your help!
 [2003-06-02 23:21 UTC] author at ninelivescomic dot com
Figured out a workaround.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 09:01:26 2024 UTC