Does php merge text on png images? How can this problem be solved?

Source: Internet
Author: User
Does php merge text on png images? RT needs to synthesize some text on a png image, but why is there a black background? The source image is, but the image I generated is the result of this browser. I need to combine some words in the blank space under the source image in the center. please help me! Does php merge text on png images?
RT

Some text needs to be synthesized on a png image, but why is there a black background?

SOURCE image is

However, the image I generated is like this.

Browser effect


I need to merge some words in the center in the blank space under the source image. please help me! Share:
------ Solution --------------------
Isn't all y coordinate 400 out of the image?
$ Url = 'http: // img.bbs.csdn.net/upload/201310/29/1383042869_349074.png ';
$ Im1 = imagecreatefrompng ($ url );

// These lines must exist. Otherwise, the shadow layer of the source image cannot pass.
$ Im2 = imagecreatetruecolor (imagesx ($ im1), imagesy ($ im1 ));
$ Bg = imagecolorallocate ($ im2, 255,255,255 );
Imagefill ($ im2, 0, 0, $ bg );
Imagecopy ($ im2, $ im1, 0, 0, 0, 0, imagesx ($ im1), imagesy ($ im1 ));

# Set the watermark font color
$ Color = imagecolorallocatealpha ($ im2, 0,100 );
 
 
# Set the font file path
$ Fontfile = "msyhbd. ttf ";
$ Fontfile = "c:/windows/fonts/FZJZJW. TTF ";
 
# Watermark text
$ Str = "We are all good children ";
$ Str = iconv ('gbk', 'utf-8', $ str );

# Watermarking
Imagettftext ($ im2, 20, 20, 20,100, $ color, $ fontfile, $ str );
Imagettftext ($ im2, 20, 20, 30,200, $ color, $ fontfile, $ str );
Imagettftext ($ im2, 20, 20, 40,300, $ color, $ fontfile, $ str );

Imagepng ($ im2 );
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.