Reputation: 21
I created a PNG image (createimagefrompng()) but the transparency won't work.
Edit: My script:
<?php
header("Content-type: image/png");
$bg = imagecreatefrompng('banner_bg.png'); // Background Image
$image = imagecreatefrompng('http://<link>/image.png');
$wit = imagecolorallocatealpha($bg, 255, 255, 255, 127);
imagecolortransparent($bg, $wit);
imagealphablending($obe, false);
imagecopy($image, $bg, 0, 0, 20, 13, 80, 40);
imagegif($bg);
imagedestroy($bg);
imagedestroy($image);
?>
------ Sorry for my bad English.
Upvotes: 0
Views: 418
Reputation: 3042
You will need to define the transparent color using imagecolortransparent()
. Also, you will need to use imagealphablending()
to set the alpha blender.
Upvotes: 0
Reputation: 17171
After calling createimagefrompng() you need to call:
imagealphablending($img, true); // setting alpha blending on
imagesavealpha($img, true); // save alphablending setting (important)
Upvotes: 1