Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

imagettfbbox returning 0's

Status
Not open for further replies.

alias301reader

Programmer
Joined
Jan 5, 2009
Messages
2
when i use $box = imagettfbbox (20, 0, "arial", 55);
then $box[1] & $box[6] are both zero

any help would be very appreciated!
 
the fourth parameter should be a string. why are you passing an integer? if you intend the string to be 55 then pass the arguments thus:

Code:
$box = imagettfbbox(20, 0, "arial", "55");

i suspect that the function is interpreting the integer 55 as a null string. but also i would expect the x value for the left hand corners to be zero in most cases (meaning left aligned). that explains $box[6]. i suspect that $box[1] is zero (if you have not made a mistake and intended to type $box[0]) because there is no text and therefor the box is zero height. but this would also mean that $box[3] should also be zero.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top