Problem using font with imagettftext
this is the error message i get when I change the environment of an effective website:
Warning: imagettftext() [function.imagettftext]: Could not find/open font
First I was thinking it cames from a lack of rights on the files, but it doesn't, I check the path and set all the files in 777... Then I check GD, and it looks like it is installed :
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.5
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
I'm trying to use an aria开发者_如何学运维l.ttf, so not much exotic I guess... Any idea where to start looking at ?
Thx
If you are using font which is in the same directory with script (no leading /
at beggining) , type just arial
without .ttf
. If it is in another directory you must include .ttf
. BTW: It would be nice if you could add code that you are using.
So here is example code:
# Correct
$font = 'arial';
# Wrong
$font = 'arial.ttf';
# Correct
$font = '/fonts/arial.ttf';
# Wrong
$font = '/fonts/arial';
PHP.NET says:
Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path.
精彩评论