note 85528 added to function.imagettfbbox
| From: | AlexanderGavazov at osu1 dot php dot net | Date: | Thu, 04 Sep 2008 10:25:55 +0000 |
| Subject: | note 85528 added to function.imagettfbbox | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144132@lists.php.net to get a copy of this message | ||
For me the best combination is from "beosman at gmail dot com" and "Nate Sweet"
<?php
function calculateTextBox($font_size, $font_angle, $font_file, $text) {
$box = imagettfbbox($font_size, $font_angle, $font_file, $text);
$min_x = min(array($box[0], $box[2], $box[4], $box[6]));
$max_x = max(array($box[0], $box[2], $box[4], $box[6]));
$min_y = min(array($box[1], $box[3], $box[5], $box[7]));
$max_y = max(array($box[1], $box[3], $box[5], $box[7]));
return array(
'left' => ($min_x >= -1) ? -abs($min_x + 1) : abs($min_x + 2),
'top' => abs($min_y),
'width' => $max_x - $min_x,
'height' => $max_y - $min_y,
'box' => $box
);
}
?>
----
Server IP: 89.190.194.18
Probable Submitter: 193.41.190.50
----
Manual Page -- http://www.php.net/manual/en/function.imagettfbbox.php
Edit -- https://master.php.net/note/edit/85528
Del: integrated -- https://master.php.net/note/delete/85528/integrated
Del: useless -- https://master.php.net/note/delete/85528/useless
Del: bad code -- https://master.php.net/note/delete/85528/bad+code
Del: spam -- https://master.php.net/note/delete/85528/spam
Del: non-english -- https://master.php.net/note/delete/85528/non-english
Del: in docs -- https://master.php.net/note/delete/85528/in+docs
Del: other reasons-- https://master.php.net/note/delete/85528
Reject -- https://master.php.net/note/reject/85528
Search -- https://master.php.net/manage/user-notes.php