note 36254 deleted from function.imagettftext by aidan

From: Date: Mon, 20 Sep 2004 10:02:16 +0000
Subject: note 36254 deleted from function.imagettftext by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77027@lists.php.net to get a copy of this message
Note Submitter: marius at trodat dot ro ---- Hello! Here is how u can put a text around a circle (i use it to create on line stamps). I have no remarks, sorry. U figure it out. Its so weird even i cant understand much now :)) <?php header('Content-type: image/png'); $imp = imagecreatefromgif('cerc.gif'); $dim=getimagesize('cerc.gif'); $lung=$dim[0]; $lat=$dim[1]; $im=imagecreatetruecolor($lung,$lat); imagecopyresampled ($im,$imp,0,0,0,0,$lung,$lat,$lung,$lat); $bg = imagecolorallocate($im, 200, 200, 200); $black = imagecolorallocate($im, 0, 0, 0); $red = imagecolorallocate($im,255,0,0); $alb=imagecolorallocate($im,255,255,255); $i=0; $text='Societatea Comerciala'; $total=strlen($text); $puncte=16; $inaltmax=0; $unghirefer=0; while($i<$total): $litera=substr($text,$i,1); $iau=ImageTTFText($im,$puncte,0,0,$lat,$alb, "serif.ttf",$litera); $lungime[$i]=($iau[2]-$iau[0]); $inalt[$i]=($iau[5]-$iau[3]); if ($inaltmax > $inalt[$i]) { $inaltmax=$inalt[$i]; } $unghi[$i]=rad2deg(atan($lungime[$i]/(($lung/2) +$inaltmax+2-($puncte/2.2)))); $unghirefer=$unghirefer+$unghi[$i]; $i++; endwhile; $i=0; $unghitot=100-$unghirefer/2; while ($i<$total): $bc=$lung/2-(sin(deg2rad($unghitot))* (($lung/2+$inaltmax-($puncte/2.2))))+ (sin(deg2rad(90-$unghitot))*(($lungime[$i]))); $ab=$lung/2-(sin(deg2rad(90-$unghitot))* (($lung/2+$inaltmax-($puncte/2.2))))- (sin(deg2rad($unghitot))*(($lungime[$i]))); $litera=substr($text,$i,1); ImageTTFText($im,$puncte,90-$unghitot,$ab,$bc,$black, "serif.ttf",$litera); $i++; $unghitot=$unghitot+$unghi[$i]; endwhile; imagepng($im); ?>

« previous php.notes (#77027) next »