ID:               23815
 Updated by:       [EMAIL PROTECTED]
 Reported By:      bjorn at smokingmedia dot com
-Status:           Feedback
+Status:           No Feedback
 Bug Type:         GD related
 Operating System: Linux pluto 2.4.18lvm-r1
 PHP Version:      4.3.1
 New Comment:

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.




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

[2003-05-26 11:50:26] [EMAIL PROTECTED]

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

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

[2003-05-26 11:43:05] bjorn at smokingmedia dot com

[[There are similar bugs in the system, but they are either closed or
said to be fixed... i think it's still not fixed..]]

i wanted to do the following. Use a transparent PNG-24(24 bits) file,
with an alpha-channel (with a drop-shadow) and merge it to a background
color. (see sample code).

this works:
imagecopy($backgroundimage, $image_id, 0, 0, 0, 0, $im_X, $im_Y);

this doesn't work:
imagecopymerge($backgroundimage, $image_id, 0, 0, 0, 0, $im_X, $im_Y,
99);
-> with any number instead of 99


sample link: 
[change the hex color code to change backgroundcolor]
this is Okay
http://www.smokingmedia.com/test_gd_fb/test?bg=ffee22

this is not okay:
http://www.smokingmedia.com/test_gd_fb/test_nk?bg=ffee22


sample code:

<?php

if(!isset($_GET[bg]) || $_GET[bg] == ""){
   $bg = "eeeeee";
   }
   else{
       $bg = $_GET[bg];
       }

$im = "test01.png";

//
// function to convert hex colorcode to decimal
//

function colordecode($hex){

   $code[r] = hexdec(substr($hex, 0 ,2));
   $code[g] = hexdec(substr($hex, 2 ,2));
   $code[b] = hexdec(substr($hex, 4 ,2));

   return $code;

} // end func colordecode

// create the resource id
$image_id = imageCreateFromPNG($im);

// get image size
$im_X = ImageSX($image_id);
$im_Y = ImageSY($image_id);

// create a truecolor background image of the right size
$backgroundimage = imagecreatetruecolor($im_X, $im_Y);

// get the desired backgroundcolor:
$code = colordecode($bg);
$backgroundcolor = ImageColorAllocate($backgroundimage, $code[r],
$code[g], $code[b]);
ImageFilledRectangle($backgroundimage, 0, 0, $im_X, $im_Y,
$backgroundcolor);

// merge the two together with alphablending on!
ImageAlphaBlending($backgroundimage, true);

// this works:
imagecopy($backgroundimage, $image_id, 0, 0, 0, 0, $im_X, $im_Y);

// this is where things go wrong:
//imagecopymerge($backgroundimage, $image_id, 0, 0, 0, 0, $im_X, $im_Y,
99);

// output the image:
Header( "Content-type: image/png");
ImagePNG($backgroundimage);

// destroy the memory
ImageDestroy($backgroundimage);
ImageDestroy($image_id);
?>

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


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

Reply via email to