note 77453 added to function.imagettfbbox
| From: | intuzetgmxdtde at osu1 dot php dot net | Date: | Thu, 30 Aug 2007 06:45:49 +0000 |
| Subject: | note 77453 added to function.imagettfbbox | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129900@lists.php.net to get a copy of this message | ||
I still got problems trying to rotate imagettftext using imagettfbbox.
It's position calculation is mostly wrong. So i tried to rotate ttftext with IMAGEROTATE.
As a special the result is in black fontcolor and transparent background.
Hope it helps sombody (thanks for function convertBoundingBox, reading below)
<?
function ImgText($text,$fontsize,$font,$angle){
$im = '';
if($text){
if(!$fontsize || $fontsize < 1) $fontsize = 12;
if(!$font) $font = "fonts/arial.ttf";
$bbox = imagettfbbox($fontsize, 0, $font, $text);
$size=convertBoundingBox($bbox);
$im = ImageCreatetruecolor($size['width'],$size['height']);
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0,0,0);
imagefill ($im, 0, 0, $white );
imagettftext($im, $fontsize, 0, $size['xOffset'], $size['yOffset'], $black,
$font, $text);
$im = imagerotate( $im,$angle, $white);
imagecolortransparent ($im,$white);
}else{
// No text
}
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 91.97.21.145
----
Manual Page -- http://www.php.net/manual/en/function.imagettfbbox.php
Edit -- https://master.php.net/note/edit/77453
Del: integrated -- https://master.php.net/note/delete/77453/integrated
Del: useless -- https://master.php.net/note/delete/77453/useless
Del: bad code -- https://master.php.net/note/delete/77453/bad+code
Del: spam -- https://master.php.net/note/delete/77453/spam
Del: non-english -- https://master.php.net/note/delete/77453/non-english
Del: in docs -- https://master.php.net/note/delete/77453/in+docs
Del: other reasons-- https://master.php.net/note/delete/77453
Reject -- https://master.php.net/note/reject/77453
Search -- https://master.php.net/manage/user-notes.php