I am trying to create an image with text by using imagettftext. It is telling me Warning: imagettftext(): Invalid font filename in C:\xampp\htdocs\recentpost.php on line 32. Here is the code on line 32 I am using to add the text
imagettftext($img, 12, 0, 20, 1, $black, "../fonts/arial.ttf", "News!");
I copied the font right out of the C:/Windows/Fonts folder so it is a valid font.
Try something like:
$font = dirname(__FILE__) . '/arial.ttf';
//OR
$font = dirname(__FILE__) . '/fonts/arial.ttf';
imagettftext($img, 12, 0, 20, 1, $black, $font, "News!");