Hi,
I'm using php 4.4.4. Maybe I'm misreading the docs, but in the
imagettfbbox manual (http://us2.php.net/imagettfbbox), it says that
text coordinates are the same regardless of what the angle is. But I
am getting two distinct sets of coordinates if I change the angle from
zero to 270.
Here's the relevant code:
$text = "hello";
$s = getImageSize($img_file);
$imgWidth = $s[0];
$imgHeight = $s[1];
$source=ImageCreateFromJPEG($img_file);
$size=16;
$black=imagecolorallocate($source,0,0,0);
$font='/usr/share/fonts/msttcorefonts/times.ttf';
$bbox=imagettfbbox($size,$angle,$font,$text);
$textWidth=$bbox[2]-$bbox[0];
$textHeight=$bbox[5]-$bbox[3];
$x=($imgWidth/2)-($textWidth/2);
$y=($imgHeight/2)-($textHeight/2);
imagettftext($source,$size,$angle,$x,$y,$black,$fo nt,$text );
header("Content-type: image/jpeg");
When I print out the bbox with 0, I get
Array ( [0] =-3 [1] =-1 [2] =41 [3] =-1 [4] =41 [5] =-16
[6] =-3 [7] =-16 )
with 270, I get
Array ( [0] =-13 [1] =-1 [2] =-13 [3] =41 [4] =-1 [5] =41
[6] =-1 [7] =-1 )
I must be misinterpreting the docs. Why are the coordinates
different? - Dave