note 79280 added to function.imageftbbox
| From: | Johan at osu1 dot php dot net | Date: | Mon, 19 Nov 2007 15:38:10 +0000 |
| Subject: | note 79280 added to function.imageftbbox | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132404@lists.php.net to get a copy of this message | ||
For alignment i used this method:
if($align == "center" || $align == "right")
{
$verticaltxtspace = $backwidth - (2 * $posx);
$spacepositions = imagettfbbox($size, $angle, "fonts/verdanaz.ttf", " ");
$spacepx = $spacepositions[4] - $spacepositions[0];
// Split text in lines
$lines = split("[\r][\n]", $text);
for($count = 0; $count < count($lines); $count++)
{
$textpositions = imagettfbbox($size, $angle, "fonts/verdanaz.ttf", $lines[$count]);
$textpx = $textpositions[2] - $textpositions[0];
if($align == "right")
{
$spaces = ($verticaltxtspace - $textpx) / $spacepx;
}
else if($align == "center")
{
$spaces = (($verticaltxtspace - $textpx)/2) / $spacepx;
}
// Add spaces
$line = $lines[$count];
for($i = 0; $i < $spaces; $i++)
{
$line = " " . $line;
}
$lines[$count] = $line;
}
// Create new text of lines
$text = "";
for($count = 0; $count < count($lines); $count++)
{
$text .= $lines[$count] . "\r\n";
}
}
// Draw the shadow text on de shadow
imagettftext($background, $size, $angle, $posx, $posy, $textcolor, "fonts/verdanaz.ttf",
$text);
----
Server IP: 213.249.64.162
Probable Submitter: 212.136.56.20
----
Manual Page -- http://www.php.net/manual/en/function.imageftbbox.php
Edit -- https://master.php.net/note/edit/79280
Del: integrated -- https://master.php.net/note/delete/79280/integrated
Del: useless -- https://master.php.net/note/delete/79280/useless
Del: bad code -- https://master.php.net/note/delete/79280/bad+code
Del: spam -- https://master.php.net/note/delete/79280/spam
Del: non-english -- https://master.php.net/note/delete/79280/non-english
Del: in docs -- https://master.php.net/note/delete/79280/in+docs
Del: other reasons-- https://master.php.net/note/delete/79280
Reject -- https://master.php.net/note/reject/79280
Search -- https://master.php.net/manage/user-notes.php