Re: GD Chinese Support - php4.3
| From: | cui yan | Date: | Sun, 23 Feb 2003 17:20:44 +0000 |
| Subject: | Re: GD Chinese Support - php4.3 | ||
| References: | 1 | Groups: | php.doc.zh |
| Request: | Send a blank email to doc-zh+get-1082@lists.php.net to get a copy of this message | ||
Eddy£ºÄãºÃ£¡
ÏÂÃæÊǶÔÄãµÄÎÊÌâµÄ½â´ð£º
ÓÉÓÚGD²»Ö±½ÓÖ§³ÖÖÐÎıàÂ룬ËùÒÔÐèҪת»»ËûÃǵ½unicode,Ö®ºóÄã¾Í¿ÉÒÔʹÓÃÁË£¬ÕâÀï
ÓÐÒ»¸ö¹ØÓÚת»»µÄº¯ÊýµÄʵÏÖ£¬Äã¿ÉÒԲο¼¡£
hey eddy:
the following code shows you how to using gd display chinese Characters.
there is a funcation called by ImageTTFText.
since gd dose not support GB2312/big5 but unicode.if you can convert
Characters to unicode which you want display then every thing will be done!
your 's yan
<?php
function gb23122uni($text) {
$rtext="";
$max=strlen($text);
for($i=0;$i<$max;$i++){
$h=ord($text[$i]);
if($h>=160 && $i<$max-1){
$rtext.="&#".base_convert(bin2hex(iconv("gb2312","ucs-2",
substr($text,$i,2))),16,10).";";
$i++;
}else{
$rtext.=$text[$i];
}
}
return $rtext;
}
Header("Content-type: image/gif");
$im = imagecreate(400,50);
$black = ImageColorAllocate($im, 0,255,0);
$white = ImageColorAllocate($im, 255,0,255);
ImageTTFText($im, 20, 0, 30, 30, $white, "c:\php\STCAIYUN.ttf",gb23122uni("
ÄãºÃ")."test");
Imagejpeg($im);
ImageDestroy($im);
?>
"Eddy-Das" <eddy@zitez.net> wrote in message
news:20030207171951.13148.qmail@pb1.pair.com...
> any one know how display Chinese Characters (tradition or simplified) in
> GD.....?
> is that something deal with multibyte functions...?
>
> Thanks
>
>
> Eddy @ Hong Kong
>
>
>