//$content 需要局中的文字
//$font需要局中的文字的字体URL(./kt.ttf)
//$fontsize需要局中的文字的字体大小
//$width 大背景的宽度
//返回居中文字起始x坐标
function widths($content,$font,$fontsize,$width) {
$array=imagettfbbox ($fontsize, 0 , $font , $content);
$widths=$array[2]-$array[0];
$widths=$width-$widths;
return $widths*0.5;
}
