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:
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?
精彩评论