我使用imagettftext()渲染文本時遇到了一些問題;不知何故,它只是顯示填充的矩形。根本沒有錯誤。 http://postimage.org/image/k61c8xi0n/使用imagettftext填充矩形而不是文本
- PHP版本:5.3.8
- GD支持:啓用
- GD版本:捆綁(2.0.34兼容)
- Freetype的支持:啓用
- Freetype的聯動:對於FreeType
- Freetype版本:2.4.3
這是代碼,沒有str安格。字體路徑的作品。
<?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);
?>
http://www.postimage.org/image/k61c8xi0n/ - > fonterror。否則,嘗試分配更多的內存:ini_set('memory_limit','256M'); – 2011-12-17 20:21:21
@ZulkhaeryBasrul已經嘗試過,沒有任何改變。仍然有錯誤。這是Arial。 – user1103838 2011-12-18 07:23:27