贡献个GD显示文字的函数(包含简体,繁体,英文)
<?php
function big52uni($text){
global $kindname;
$rtext="";
$max=strlen($text);
if($kindname=='tw'){
for($i=0;$i<$max;$i++){
$h=ord($text[$i]);
if($h>=160 && $i<$max-1){
$rtext.="&#".base_convert(bin2hex(iconv("big5","ucs-2",substr($text,$i,2))),16,10).";";
$i++;
}else{
$rtext.=$text[$i];
}
}
}else{
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;
}
$m_textfont = "c:/winnt/fonts/SIMHEI.ttf";
$m_picture_height=430;$m_picture_width=750;
$m_image=ImageCreate($m_picture_width,$m_picture_height);
$m_bgcolor=Imagecolorallocate($m_image,224,226,219);//
$m_caption_color=Imagecolorallocate($m_image,0,125,212);//
$m_lable_color=Imagecolorallocate($m_image,28,196,96);//
$m_text_color=Imagecolorallocate($m_image,245,73,73);//
$m_scale_color=Imagecolorallocate($m_image,60,0,20);//
$m_coordinate_color=Imagecolorallocate($m_image,0,0,0);//
Imagefill($m_image,0,0,$m_bgcolor);//画图
ImageTTFText($m_image, 20, 0, 200, 15, $m_text_color,$m_textfont,big52uni("中国"));
Imagepng($m_image);
Imagedestroy($m_image);
?>