Home  >  Article  >  Backend Development  >  Example of using GD to output Chinese characters in PHP_PHP tutorial

Example of using GD to output Chinese characters in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 10:59:58940browse

//Define the output as image type
header("content-type:image/gif");
//New image
$pic=imagecreate(240,30);
//Define black and white color
$black=imagecolorallocate($pic,0,0,0);
$white=imagecolorallocate($pic,255,255,255);
//Define font
$font="c://WIN2000//fonts//simhei.ttf";
//Define output font string
$str = chr(0xE8).chr(0xB5).chr(0x9B).chr(0xE8).chr(0xBF).chr(0xAA).chr(0xE7).chr(0xBD).chr(0x91)." http ://www.itbbs.cn";
//Write TTF text into the picture
imagettftext($pic,12,0,10,20,$white,$font,$str);
//Create GIF graphics
imagegif($pic);
//End graphics and release memory space
imagedestroy($pic);
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445543.htmlTechArticle//Define the output as image type header(content-type:image/gif); //Create new image$ pic=imagecreate(240,30); //Define black and white color $black=imagecolorallocate($pic,0,0,0); $white=imagecolor...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn