我有一个为 png transaprency 支持创建的图像资源,其中包含以下内容:
$image = imagecreatetruecolor($new_width, $new_height);
imagealphablending($image, false);
imagesavealpha($image, true);
$new_image_bg = imagecolorallocatealpha($image, 255, 255, 255, 127);
imagefill($image, 0, 0, $new_image_bg);
然后,我使用 将重叠的文本层添加到此图像资源中imagettftext()
,但这会覆盖图像的当前区域。我正在尝试将其合并到现有的图像资源中,以保持文本字符串的透明度。下面是我试图避免的一个例子: