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()
imagestring
Basically powerless