Php 使用imagettftext创建的重叠文本字符串
我有一个为png跨行业支持创建的图像资源,包括:Php 使用imagettftext创建的重叠文本字符串,php,imagettftext,Php,Imagettftext,我有一个为png跨行业支持创建的图像资源,包括: $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,
$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()
将重叠的文本层添加到此图像资源中,但是这会覆盖图像的当前区域。我试图将其合并到现有的图像资源中,以保持文本字符串的透明度。下面是我试图避免的一个例子:
您是否为正在制作的图像定义了透明颜色?一种解决方案是:与其将文本直接放置在目标图像中,不如将其放置在次图像中,然后执行
imagecopymerge()
操作