开发者

overlapping text strings created with imagettftext

开发者 https://www.devze.com 2023-03-16 14:08 出处:网络
I have an image resource created for png transaprency support with the following: $image = imagecreatetruecolor($new_width, $new_height);

I have an image resource created for png transaprency support with the following:

$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);

I'm then adding overlapping layers of text to this image resource with imagettftext(), however this overwrites the current area of the image. I'm trying to merge this into the existing image resource maintaining the transparency of the text str开发者_运维问答ing. Below is an example of what I'm trying to avoid:

overlapping text strings created with imagettftext


One solution is: rather than placing text directly in your target image, place it in a secondary image and then perform an imagecopymerge() operation.


Have you defined a transparent colour for the image that you are making?

0

精彩评论

暂无评论...
验证码 换一张
取 消