$font, 'size' => $size, 'text' => $text, 'color' => $color, 'bcolor' => $bcolor); $sum = md5(serialize($data)); $filename = $sum.'.png'; $Image_Width=600; $Image_Height=85; // Create the image $im = imagecreatetruecolor ($Image_Width, $Image_Height); { $wh = imagecolorallocate($im, hexdec(substr($bcolor, 0, 2)), hexdec(substr($bcolor, 2, 2)), hexdec(substr($bcolor, 4, 2))); $bl = imagecolorallocate($im, hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2))); imagefill($im,0,0,$wh); // $text = gentext(); $Text_Box_Size = imagettfbbox($size, 0, $font, $text); $Text_Box_Width = abs($Text_Box_Size[2] + $Text_Box_Size[0]); $Text_Box_Height = abs($Text_Box_Size[7] + $Text_Box_Size[1]); $Text_Height = $Text_Height + $Text_Box_Height; $posx = ($Image_Width - $Text_Box_Width) / 2; $posy = ($Image_Height - $Text_Box_Height * sizeof($text)) / 2 + $Text_Height; imagettftext($im, $size, 0, $posx, $posy, $bl, $font, $text); // imagettftext($im,10,0,10,91,$bl,$font,$sum); header("Content-type: image/png"); imagepng($im,$filename); } imagepng($im); imagedestroy($im); function gentext() { $text=''; for ($i=28; $i<256; $i++) $text .= chr($i); return $text; }