开发者

How can I auto adjust the width of a GD-generated image to fit the text?

开发者 https://www.devze.com 2023-01-31 21:34 出处:网络
I\'m trying to display a number using GD. This number changes, so sometimes the width needs to change. Is there a开发者_如何转开发 way to calculate how wide the text will be so that I can dynamically

I'm trying to display a number using GD. This number changes, so sometimes the width needs to change. Is there a开发者_如何转开发 way to calculate how wide the text will be so that I can dynamically set the width?


Yes, you can find out the dimensions of a text using imagettfbbox() (or imageftbbox() if you're using Freetype).

0

精彩评论

暂无评论...
验证码 换一张
取 消