<?php
header("Content-type: image/png");  //声明类型
// $tel = $_POST['user'];
$myfont=$_GET['f']; 
$myfont="inallfonts/".$myfont;  
$tel = "文字效果测试1234567890";
$tel=iconv("GB2312", "UTF-8",$tel);
$string =iconv("GB2312", "UTF-8",$tel);

$fontarea=ImageTTFBBox(12,0,$myfont,$tel);
$font_width = $fontarea[4]-$fontarea[0]; 
$font_height = $fontarea[1]-$fontarea[7]; 
$im = ImageCreateTrueColor($font_width+8,$font_height+5); 
$white=imagecolorallocate($im,255,255,255);
imagefill($im,0,0,$white); 



$tel_width = imagettfbbox(0, 9, $myfont, $tel);
$x_value = (5);   //字体的开始位置 可以直接给值
$color = imagecolorallocate($im,233, 14, 91);  //字体颜色 10进制表示


imagettftext($im, 12, 0, $x_value, 16, $color, $myfont, $tel); 

//尝试加边框

//$green = ImageColorAllocate($im, 0, 255, 0);
//$border =ImageColorAt($im,$x_value, 16);  
//ImageFillToBorder($im, $x_value,16,$color, $green);

//尝试加边框结束

//12代表 字体大小
imagegif($im);
imagedestroy($im);
?>