imagestring How do I export Chinese characters to a picture?

Source: Internet
Author: User
Try to use Iconv to transcode Chinese characters and output, but still garbled

    $s="你若输出,便是晴天";    $ss=iconv("gb2312","utf8",$s);    $im=ImageCreate(400,400);    $black=ImageColorAllocate($im,0x00,0x00,0x00);    ImageString($im,5,200,200,$ss,$black);    Header('Content-Type:image/png');    ImagePNG($im);

Searched the internet for a long time and did not find a solution. How does this break?

Reply content:

Try to use Iconv to transcode Chinese characters and output, but still garbled

    $s="你若输出,便是晴天";    $ss=iconv("gb2312","utf8",$s);    $im=ImageCreate(400,400);    $black=ImageColorAllocate($im,0x00,0x00,0x00);    ImageString($im,5,200,200,$ss,$black);    Header('Content-Type:image/png');    ImagePNG($im);

Searched the internet for a long time and did not find a solution. How does this break?

imagestring Use dot Matrix, if you really want to use his words need to construct the Chinese lattice font, and then use Imageloadfont to load.
A more recommended and common practice is to use the Imagettftext function


  
   

Output Chinese Best useimagettftext()

imagestringBasically powerless

  • 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.