Solve the problem of GD Chinese garbled characters
Source: Internet
Author: User
To solve the problem of GD Chinese garbled text, I carefully studied some related GD technologies today, and also studied the problem of GD Chinese garbled text.
Using the GD library to output a Chinese string, it is useless to call imagestring. You need to use the imagettftext () function. For details about how to use the imagettftext function, refer to the manual.
Here is an example:
$ Pic = imagecreate (250,30 ); $ Black = imagecolorallocate ($ pic, 0, 0 ); $ White = imagecolorallocate ($ pic, 255,255,255 ); $ Font = "C: // WINDOWS // Fonts // simhei. ttf"; // The path here must be the character path. $ Str = 'php'. iconv ('gb2312', 'utf-8', 'face object'). "www.phpobject.net "; Imagettftext ($ pic, 10, 0, 10, 20, $ white, $ font, $ str );
In the previous section, I provided a simple GD watermark example to illustrate how to use an image watermark. here is a simple code for text watermark.
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.