【发布时间】:2014-12-13 13:48:27
【问题描述】:
我想更改以下代码中的字体...
header("Content-type: image/png");
$text = $_POST['wtr'];
$font = 'fonts/arial.ttf';
$im = @imagecreate(90, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 1, 5, 5, $text, $text_color);
imagepng($im);
imagedestroy($im);
此代码用于工作并将我的文本转换为图像。
更新:
如何设置背景图片。
【问题讨论】:
-
我检查了 '$font_width = imagefontwidth(36);'但不工作。字体大小仍然保持不变..
-
我将 '$font = 'fonts/arial.ttf'' 更改为 '$font = 'fonts/Arial.ttf';'它工作....