我有imagecreatetruecolor函数的问题,我写这个代码,但它让我的背景白色可以有人告诉我哪里出错了?我有一个输入图像数组,首先我创建第一个图像宽度和高度的空图层,并尝试使其透明
foreach($form_fields as $fm)
{
$layer = imagecreatefromstring(file_get_contents($fm));
$layerWidth = imageSX($layer);
$layerHeight = imageSY($layer);
if (!isset($slate))
{
$slate = imagecreatetruecolor($layerWidth, $layerHeight);
imagealphablending($slate, false);
$trans_colour = imagecolorallocatealpha($slate, 255, 255, 255, 127);
imagefill($slate, 0, 0, $trans_colour);
imagealphablending($slate,true);
imagesavealpha($slate,true);
}
imagecopy($slate, $layer, 0, 0, 0, 0, $layerWidth, $layerHeight);
imagealphablending($slate,true);
imagedestroy($layer);
}
imagetruecolortopalette($slate, false, 256);
imagepng($slate, $CreatedAvatar);
imagedestroy($slate);