[Solved] could not find open font PHP GD

Although GD is installed, you are unable to view images created by the PHP GD library.


The following error is displayed in the error logs:

[function.imagettftext]: Could not find/open font


To resolve this issue, add ./ before the font name.


For example, if your script has $font = 'arial.ttf';


Change this line to $font = "./arial.ttf";

The images are now displayed on the web page.

Thanks to Dagondesign.com, here's a neat script to check if your server has GD enabled


/* Displays details of GD support on your server */

echo '<div style="margin: 10px;">';

echo '<p style="color: #444444; ">GD is ';

if (function_exists("gd_info")) {

echo '<span style="color: #00AA00; font-weight: bold;">supported</span> by your server!</p>';

$gd = gd_info();

foreach ($gd as $k => $v) {

echo '<div style="width: 340px; border-bottom: 1px solid #DDDDDD; padding: 2px;">';

echo '<span style="float: left;width: 300px;">' . $k . '</span> ';

if ($v)

echo '<span style="color: #00AA00; font-weight: bold;">Yes</span>';


echo '<span style="color: #EE0000; font-weight: bold;">No</span>';

echo '<div style="clear:both;"><!-- --></div></div>';


} else {

echo '<span style="color: #EE0000; font-weight: bold;">not supported</span> by your server!</p>';


echo '</div>';