getTextSize($font,$size,0,$string); $tw = abs($getTextSize[4])+abs($getTextSize[0]); $th = abs($getTextSize[1])+abs($getTextSize[5]); $ns = abs($getTextSize[5]); $im = ImageCreateTrueColor($tw+2,$th+2); $transparent = ImageColorAllocateAlpha($im, 0, 0, 0, 127); ImageFill($im, 0, 0, $transparent); ImageSaveAlpha($im, true); if ($border == '1') { ImageTTFTextOutline($im, $size, 0, 0 + 1, $ns + 1, '0xFFFFFF', '0x000000', $font, $string, '1'); } ImageTTFText($im,$size,0,0+1,$ns+1,'0x'.$color,$font,$string); ImagePng($im, $cacheFile); Header("Content-Length: ".(string)(filesize($cacheFile))); Header("Content-type: image/png"); ImagePng($im); ImageDestroy($im); } function ImageTTFTextOutline($im, $size, $angle, $x, $y, $col, $outlinecol, $fontfile, $text, $width) { for ($xc = $x - abs($width); $xc <= $x + abs($width); $xc++) { for ($yc = $y - abs($width); $yc <= $y + abs($width); $yc++) { imagettftext($im, $size, $angle, $xc, $yc, $outlinecol, $fontfile, $text); } } } ?>