Warning: imagettfbbox(): Could not find/open font in

Tue, 2 Nov 2010

This was annoying me and I didn't find an answer as quick as I'd like. I was getting this error when trying to load a font by a CAPTCHA script in PHP. My first thought was the CHMOD permissions needed to be changed, but I found out it needed an absolute path.

So the fix for: Warning: imagettfbbox(): Could not find/open font in is by adding the absolute path, for example:

<?php
$this->_useFont = getcwd() .'/actionj.ttf';
imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->_useFont , $this->_Code) 
	or die('Error in imagettftext function');