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.
After calling createimagefrompng() you need to call:
imagealphablending($img, true); // setting alpha blending on
imagesavealpha($img, true); // save alphablending setting (important)
You will need to define the transparent color using imagecolortransparent()
. Also, you will need to use imagealphablending()
to set the alpha blender.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.