Click to See Complete Forum and Search --> : Could not find/open font
I keep getting the error "Warning: Could not open/find font in ..." when making calls to ImageTTFBBox and ImageTTFText. I'm running Apache on Win2000, and I'm sure I'm using the correct filename and path. Why won't it open these truetype files? I have GD version 2.0 or higher enabled, and FreeType Linkage, yet these functions won't work! What's wrong??
Yeah, I'm having the same problem, everything is installed properly (ver 4.06)according to phpinfo() but it won't work.
I understand from the bugs list on www.php.net that there was a problem with this function on WINNT where it could not open the TTF file in question, and this it has been resolved in the CVS.
As I can not recompile PHP (no compiler for NT etc) does any one know where I can download a version with this patch in it.
Thanks
John
I use PHP in Linux with Apache, and have the same problem when I use ex:
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "arial.ttf", $text);
(file .php same dir with .ttf)
but if I use absolutely .ttf path:
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "/usr/local/apache/htdocs/arial.ttf", $text);
->it works!
I don't know why.
Try this under Windows!!!
$fontfile="/WINNT/Fonts/arial.ttf";
ImageTTFText ($image, 15, 0, 10, 20, $white, $fontfile,"Testing...");
p.s. Thanks for your suggestion Luan, it helped!
I had the same problem, "could not find/open font", using php_gd2.dll on PHP 4.2.1 from www.zend.com on Windows XP...
... but going back to 4.2.0 (downloadable frmo www.php.net) made everything happy again...
Try to escape all '\' with '\\' in your path to the font.
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.