I'm using the GD library for PHP, and using functions like imagestring() and imagestringup() to add text to pictures. I am using the built-in fonts with latin2 encoding. Is there a way, with a given string, to calculate the length (in pixels) of the string?
I want to calculate the length in pixels of the strings because the strings are variable and I want to make sure the string doesn't overflow the area I want to put it in.
Thanks for your help.
imagettfbbox() does that: http://www.php.net/manual/en/function.imagettfbbox.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With