ID:               17263
 Comment by:       rbap at yap dot org
 Reported By:      nicolaasuni at tiscali dot it
 Status:           No Feedback
 Bug Type:         GD related
 Operating System: Windows XP Pro or Linux
 PHP Version:      4.2.3
 New Comment:

If you experience such problem, 
Please try using this CVS snapshot:

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

It worked for me.
This problem is still in the php4.3.1, to solve it use the snapshot


Previous Comments:
------------------------------------------------------------------------

[2003-04-04 05:53:16] rbap at yap dot org

Another comment to the above.
On the production server I had the same problem with php4.2.2 and
external (of course) GDlib 2.0.
That's why I think the problem is in the GDlib version.

------------------------------------------------------------------------

[2003-04-04 05:50:16] rbap at yap dot org

I experience the same problem on the production system.
For development I use rh8, php4.2.2 and GDlib I guess version 1.8.x

As production rh7, php4.3.1 and the bundled GDlib 2.0 compatible

I am not sure but I think the problem reside in the GD 2.0 lib. 

The following proble occour ONLY with palet image.
Basically my script create a button starting form a basic png and
adding the text.
The script work fine in devel but in production has problem.
When I try to resize the basic button for longer text it seems that
both imagecopyresized and imagecopyresampled does not copy the image.
In the example after the imagecopyresized there is a imagecolorstotal,
it return correcly the number of colors in the image (if you put it
before it return 1, the background).
So it seems that the palet is setted correclty but not the image. If I
create a trucolor image instead of a palet image it works but I do not
have transparency.
Here follow an example code:
<?php
/*
The following script is only an example, the original one is a bit more
complex
it is made only to reproduce the problem.
*/

//the start button.png is a palet image with tranpsarency with around
16 colors
$im = imagecreatefrompng("/path/to/base/button.png");
/* $textwidth = calculation for the new width based on the text; */
$dst_img = imagecreate($textwidth, imagesy($im));
$bkgc  = imagecolorallocate ($dst_img, 0, 0, 255);
/*
imagecopyresized( resource dst_im, resource src_im, int dstX, int dstY,
int srcX, int srcY, int dstW, int dstH, int srcW, int srcH )
*/
imagecopyresized($dst_img, $im, 0, 0, 0, 0, $textwidth, imagesy($im),
1, imagesy($im));
//echo "<p>Total Color: " . imagecolorstotal ($dst_img) ."</p>";
imagecolortransparent($dst_img, $bkgc);
header("Content-type: image/png");
Imagepng($dst_img);
?>

------------------------------------------------------------------------

[2003-01-15 03:39:58] jukkaho at mail dot student dot oulu dot fi

I was hit by this bug also.

GD 2.0 bundled with PHP 4.3.0 has this bug also. This was tested with
Linux.

No output is coming when I'm trying to use imagecreatefrompng() from an
indexed color image to a imagecreate()-image using imagecopyresized().

When using imagecreatetruecolor()-image as a target, copying works ok.

------------------------------------------------------------------------

[2002-11-22 13:22:43] th at hahn-software dot de

PHP Version 4.2.3 with GD Library 1.8.4(!!) => imagecopyresized works
'without' Color Problems.

PHP Version 4.2.3 with GD Library above 2.0
=> imagecopyresized change the Colors dramatical

------------------------------------------------------------------------

[2002-10-14 19:26:50] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/17263

-- 
Edit this bug report at http://bugs.php.net/?id=17263&edit=1

Reply via email to