|
Posted by Krustov on 12/01/06 21:34
<comp.lang.php>
<Krustov>
<Fri, 1 Dec 2006 20:34:27 -0000>
<MPG.1fdaa2333d32bec98a26b@news.newsreader.com>
> Whats the best way to do it ? .
>
The below seems to work ok .
It seems strange that such a common feature like a align L/C/R parimeter
should be left out of a text function .
<?php
$text=$kk[4];
if ($kk[4]=="") {$text="MAIN MENU"; $kk[1]="mainmenu";}
$img_name="images/zdefault.jpg"; $source=ImageCreateFromJPEG($img_name);
$grey=imagecolorallocate($source,213,224,225);
$black=imagecolorallocate($source,0,0,0);
$font='arial.ttf';
$bbox=imagettfbbox(28,$angle,$font,$text);
$textWidth=$bbox[2]-$bbox[0];
$z=$bbox[2]/2;
$x=320-$z;
$y=37;
imagettftext($source,28,0,$x+2,$y+2,$grey,$font,$text);
imagettftext($source,28,0,$x,$y,$black,$font,$text);
$new_name="cat/$kk[1].jpg";
ImageJPEG($source,$new_name);
imagedestroy($source);
?>
--
www.phpwhois.co.uk
Navigation:
[Reply to this message]
|