ASP has a MeasureString function that returns the width, in pixels, of a string given a certain font/size. Is this possible in PHP?
+3
A:
Yes, using GD library.
http://www.php.net/manual/en/function.imagettfbbox.php
this is for text rendered on an image. Text width varies a bit depending on the browser, OS (font smoothing, different rendering)
Alexander
2010-07-01 21:12:01
Thank you very much.
Debashis
2010-07-01 21:23:31
+1
A:
Perhaps you could use the imagettfbbox function if you have GD installed
HCL
2010-07-01 21:12:08