Warning: imagettftext() [function.imagettftext]: Could not find/open font in /home/a2424901/public_html/index.php on line 35

From the docs

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.

This seems to imply that the fontfile should be an absolute path, and if it isn’t, the function will append another .ttf onto the end of it.

Specify the full path to the font file.

$font = "/home/a2424901/public_html/Arial.ttf";

Or omit the .ttf and use the GDFONTPATH. The documentation recommends the following:

In many cases where a font resides in the same directory as the script using it the following trick will alleviate any include problems.

putenv('GDFONTPATH=' . realpath('.'));
$font = "Arial";

Leave a Comment