note 38880 added to function.imagettfbbox
| From: | oliver dot martin at onemail dot at | Date: | Fri, 09 Jan 2004 18:13:18 +0000 |
| Subject: | note 38880 added to function.imagettfbbox | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-63227@lists.php.net to get a copy of this message | ||
The original fixbox function by <php at deathz0rz dot homeunix dot net> doesn't work when
the text is rotated, as it assumes that the upper left corner of the text is also the upper left
corner of the bounding box. Same goes for the lower right corner. Here is my corrected version of
it:
<?
function fixbbox($bbox)
{
$tmp_bbox["left"] = min($bbox[0],$bbox[2],$bbox[4],$bbox[6]);
$tmp_bbox["top"] = min($bbox[1],$bbox[3],$bbox[5],$bbox[7]);
$tmp_bbox["width"] = max($bbox[0],$bbox[2],$bbox[4],$bbox[6]) -
min($bbox[0],$bbox[2],$bbox[4],$bbox[6]);
$tmp_bbox["height"] = max($bbox[1],$bbox[3],$bbox[5],$bbox[7]) -
min($bbox[1],$bbox[3],$bbox[5],$bbox[7]);
return $tmp_bbox;
}
?>
However, be aware that this might not be very useful, as gd-2.0.8 introduces a bug which renders the
results of imagettfbbox() useless when the text is rotated. This is still not fixed in the the
php-4.3.4 bundled version (2.0.15 compatible).
----
Manual Page -- http://www.php.net/manual/en/function.imagettfbbox.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38880
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38880&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38880&report=yes
Search -- http://master.php.net/manage/user-notes.php