note 86593 added to function.imagecolortransparent
| From: | steved at HaHaHa dot com dot au | Date: | Sat, 25 Oct 2008 05:28:47 +0000 |
| Subject: | note 86593 added to function.imagecolortransparent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145733@lists.php.net to get a copy of this message | ||
How to center your text both vertically and horizontally in a GD image:
//get box size
$box = imagettfbbox($titlesize, 0, $titlefont, $title);
//Find out the width and height of the text box
$textW = $box[2] - $box[0];
$textH = $box[5] - $box[3];
// Calculate the positions
$positionLeft = ($width - $textW)/2;
$positionTop = (($height - $textH)/2);
// Add some text
if($align=="center"){
imagettftext($pic, size, angle, $positionLeft, $positionTop, colour, font, message);
----
Server IP: 209.41.74.194
Probable Submitter: 58.96.40.116
----
Manual Page -- http://www.php.net/manual/en/function.imagecolortransparent.php
Edit -- https://master.php.net/note/edit/86593
Del: integrated -- https://master.php.net/note/delete/86593/integrated
Del: useless -- https://master.php.net/note/delete/86593/useless
Del: bad code -- https://master.php.net/note/delete/86593/bad+code
Del: spam -- https://master.php.net/note/delete/86593/spam
Del: non-english -- https://master.php.net/note/delete/86593/non-english
Del: in docs -- https://master.php.net/note/delete/86593/in+docs
Del: other reasons-- https://master.php.net/note/delete/86593
Reject -- https://master.php.net/note/reject/86593
Search -- https://master.php.net/manage/user-notes.php