vitovt
Advanced Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору header("Content-type: image/jpeg"); $imagewidth = 250; $imageheight = 50; $fontsize = 36; $space = 6; $xpos = 20; $ypos = 40; $text = "Example"; $im = imagecreate ($imagewidth, $imageheight); $bgcolor = ImageColorAllocate ($im, 202, 112, 112); $font = ImageColorAllocate ($im, 255, 255, 255); function make_text($char, $xpos, $fontsize, $space, $imagewidth, $imageheight) { global $im, $ypos, $font; $thetextbox = ImageTTFBBox ($fontsize, 0, "arial.ttf", $char); ImageTTFText ($im, $fontsize, 0, $xpos, $ypos, $font, "arial.ttf", $char); return $xpos+$thetextbox[4]+$space; } for($i=0;substr($text, $i,1);$i++) { $xpos = make_text(substr($text, $i,1), $xpos, $fontsize, $space, $imagewidth, $imageheight); } Imagepng ($im); ImageDestroy ($im);
|