Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试生成文本图像。
所以我创建了一个新字体:
$font = '../fonts/Arial.ttf';
然后我为文本添加一些背景
imagefilledrectangle($image, 0, 0, ?, 12, $green);
并添加文字
imagettftext($image, 12, 0, 0, 12, $white, $font, $text);
问题是现在我不知道如何获得 12 号字体的宽度。
谢谢。
使用ImageTTFBBox()