我在使用 imagettftext() 渲染文本时遇到了一些问题;不知何故,它只是显示填充的矩形。完全没有错误。http://postimage.org/image/k61c8xi0n/
- PHP版本:5.3.8
- GD 支持:已启用
- GD 版本:捆绑(2.0.34 兼容)
- 自由类型支持:启用
- Freetype联动:带freetype
- 自由类型版本:2.4.3
这是代码,没什么奇怪的。字体路径有效。
<?php
header("Content-type: image/png");
$template = imagecreatefrompng("template.png");
imagealphablending( $template, false );
imagesavealpha( $template, true );
$white = imagecolorallocate($template, 255, 255, 255);
imagettftext($template, 20, 0, 100, 50, $white, 'arial.ttf', 'Some text');
imagepng($template);
?>