|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-06-09 08:55 UTC] ulf at ecora dot de
TTF-Fonts don't work on WinXP with PHP 4.2.1 and GD 2.0.1 and on Suse Linux with PHP 4.2.0 and GD 2.0.1 On every use with imagettftext or imagettfbbox: Could not find/open font in e:\try\bild.php4 on line x $im = imagecreate(420,315); $grey = imagecolorallocate($im, 60, 60, 60); imagettftext($im, 80, 0, 20, 50, $grey, 'font.ttf', 'test'); imagejpeg($im); font.ttf is in the same directory like the PHP-Script and an absolute path will also not work. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 05:00:01 2025 UTC |
I believe this bug is not fixed. Script E:\try\test\test.php Font E:\try\gd\font.ttf putenv("GDFONTPATH=E:\try\gd\"); imagettftext($im, 20, 0, 10, 5, $grey, 'font.ttf', 'beep'); Apache.exe tried to open E:\try\gd\e:\try\test\font.ttf.ttf putenv("GDFONTPATH="); imagettftext($im, 20, 0, 10, 5, $grey, 'font.ttf', 'beep'); Apache.exe tried to open C:\winnt\fonts\e:\try\test\font.ttf.ttf But my WinXP is in c:\XP. This hardcoded Path (C:\winnt\) is a bad idea.My provider has php 4.2.3 and I sorrily can't upgrade his php... ;-) My code is this: ... $bild = $_GET["bild"]; header("Content-type: image/png"); $img = imagecreatefrompng("../bin/B_Jahr.png"); $hc = imagecolorallocate($img,0,0,0); $tsize = 11; $xpos = 7; $ypos = 15; imagettftext($img,$tsize,0,$xpos,$ypos,$hc,"../bin/comic.ttf",$bild); imagepng($img); imagedestroy($img); ... and it worked fine until my provider upgraded the version to 4.2.3. It's a huge German provider (1&1) and they are not able to upgrade quickly. Is there any workaround for the ttf-problem instead? Absolute path didn't work. Thankful Peter