List Info

Thread: note 77453 added to function.imagettfbbox




note 77453 added to function.imagettfbbox
user name
2007-08-30 01:45:49
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  -- h
ttps://master.php.net/note/delete/77453/integrated
Del: useless     -- http
s://master.php.net/note/delete/77453/useless
Del: bad code    -- htt
ps://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     -- http
s://master.php.net/note/delete/77453/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/77453
Reject      -- https://mast
er.php.net/note/reject/77453
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )