当我使用GD库在php中执行和图像叠加时,我总是会得到黑色背景,但是,所有图像都正确叠加。有人可以帮忙吗?PHP中的图像叠加;黑色背景?
<?php
$images = array($_GET['color'], $_GET['face'], $_GET['hat']);
$img = imagecreatetruecolor(58, 75);
imagealphablending($img, true);
imagesavealpha($img, true);
imagecolorallocate($img, 255, 205, 255);
imagecolorallocate($img, 255, 255, 255);
imagecolortransparent($img, $white);
imagefilledrectangle($img, 0, 0, $imgWidth, $imgHeight, $white);
foreach($images as $fn) {
$cur = imagecreatefrompng($fn);
imagealphablending($cur, true);
imagesavealpha($cur, true);
imagecopy($img, $cur, 0, 0, 0, 0, 58, 75);
imagedestroy($cur);
}
header('Content-Type: image/png');
imagepng($img);
?>
我编辑帖子的脚本到我最新的脚本。仍然显示黑色。 – Seth 2010-12-12 14:34:30
啊!得到它了!谢谢。 – Seth 2010-12-12 19:16:29