note 41787 added to function.imageftbbox
| From: | sectionthirty1 at yahoo dot com | Date: | Thu, 22 Apr 2004 06:50:43 +0000 |
| Subject: | note 41787 added to function.imageftbbox | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68512@lists.php.net to get a copy of this message | ||
Here is a handy example I used to center "dynamic text" onto an image.
Ex. Say you want to center a clients IP Address onto a picture.
$ip=$_SERVER['REMOTE_ADDR'];
$details = imageftbbox($fontsize, 0, $font, $ip, array("linespacing" => 1));
$xcoord = ($imgwidth - $details[4]) / 2; // this will return the x coordinate centered to your
specific image. Make sure you set $imgwidth to the width of the image you are using.
imagettftext($image, $fontsize, 0, $xcoord, $ycoord, $fontcolor, $font, $ip);
----
Manual Page -- http://www.php.net/manual/en/function.imageftbbox.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41787
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41787&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41787&report=yes
Search -- http://master.php.net/manage/user-notes.php