Jump to content

Gd - Imagecolortransparent()


clonetrooper9494

Recommended Posts

I am not very familiar with GD, I am trying to put a small icon on to a larger background, and when I try to make the icon transparent, it doesn't work! I can't find the problem, here is the code:

<?phpheader('content-type: image/png');$im = imagecreatefrompng('cc_header.png');$minion = imagecreatefrompng('basherred.png');$white = imagecolorallocate($minion, 255, 255, 255);imagecolortransparent($minion, $white);imagecopy($im, $minion, 440, 0, 0, 0, 75, 75);imagecolortransparent($minion, $white);imagepng($im);imagedestroy($im);imagedestroy($minion);?>

The out is here: http://www.clonedrone.com/cc_api/mt/images/banner.phpThe little red guy is $minion, and the rest of the image is $imThe confusing part is when I make $im transparent, it worked kinda($minion still showed a white BG) but when I loaded the image in to a page with as green BGcolor, the image was transparent in the areas it was white...~clone

Link to comment
Share on other sites

You're changing white to transparent in the $minion image, but not in the $im image, so the transparency would only show if you were using imagepng() on $minion.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...