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";
Why could imagettfbbox() not read font in x on line y?
The problem was solved by re-uploading the font files. They were uploaded through Filezilla in ASCII mode instead of the correct Binary mode. By that the font files became corrupt.
P.S. I did not set GDFONTPATH
and it works with all those paths without problems:
captcha/fonts/assimila.ttf
captcha/fonts/assimila
/home/{Userpath}/captcha/fonts/assimila.ttf
Invalid font filename unable to use .ttf file in PHP
Already solved it, thanks to the people in the comment section.
I just had to use the full file path (C://.../fonts/arial.ttf)
Fatal error: Call to undefined function facebook() in /home/a2424901/public_html/index.php on line 7 . Please help in making this code correct
You're missing the new
keyword before trying to instantiate a Facebook
object, though it appeared that you did have it in your previous question.
This line:
$facebook = Facebook(array(
should be
$facebook = new Facebook(array(
Related Topics
How to Make Sure That Values from MySQL Keep Their Type in PHP
Display Only 3 Foreach Result Per Row
Getting the Difference Between Two Time/Dates Using PHP
Generating Confirmation Code for an Email Confirmation
Why Would I Use Dirname(_File_) in an Include or Include_Once Statement
Process Very Big CSV File Without Timeout and Memory Error
When Should I Use a Bitwise Operator
How to Bind Decimal/Double/Float Values with Pdo in PHP
Populate Select Drop Down from a Database Table
How to Get Files in Ftp Folder Sorted by Modification Time
MySQL & PHP Parameter 1 as Resource
PHP Date Conversion to Strtotime
How to Learn About PHP Internals
PHP Code Formatter/Beautifier and PHP Beautification in General