Am trying to use the gd library with freetype to write some texts on my image for facebook app(find code below) but am having the error: Warning: imagettftext() [function.imagettftext]: Could not find/open font in /home/xxx/public_html/yyy/zzz/abc.php on line 49
Specifications: PHP Version 5.3.26 GD Support enabled GD Version bundled (2.1.0 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.3.11
I found something like '--with-freetype-dir=/usr' too
My code:
$font='arial.ttf';
$text_color = imagecolorat($unprocessedimagejpeg,317,165);
imagettftext($unprocessedimagejpeg, 16,0,0,16,$text_color,$font,'This is the text');
/*I also tried
putenv('GDFONTPATH=' . realpath('.'));
$font = 'arial.tff'; but to no avail
*/
What can be the problem that am getting the error? Should I inlcude the freetype in the php file? (how) Should I be knowing the full path to my font file? How to proceed? Thanks in advance! Also what would be the path to arial.tff ?? or all the fonts available?