Example of using GD to output Chinese characters in PHP. Define the output as the image type header (content-type: imagegif); create an image $ picimagecreate (); define the black and white color $ blackimagecolorallocate ($ pic, 0 ); $ whiteimagecolor // define the output as an image type
Header ("content-type: image/gif ");
// Create an image
$ Pic = imagecreate (240,30 );
// Define the black and white colors
$ Black = imagecolorallocate ($ pic, 0, 0 );
$ White = imagecolorallocate ($ pic, 255,255,255 );
// Define the font
$ Font = "c: // WIN2000 // fonts // simhei. ttf ";
// Define the 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 to the graph
Imagettftext ($ pic, 12, 0, 10, 20, $ white, $ font, $ str );
// Create a GIF image
Imagegif ($ pic );
// End the image and release the memory space
Imagedestroy ($ pic );
?>
Expose header (content-type: image/gif); // create an image $ pic = imagecreate (); // define the black and white color $ black = imagecolorallocate ($ pic, 0); $ white = imagecolor...