Can someone show me a basic imageftbbox function please because im having trouble getting it to work this is what ive tried so far
$bird = imageftbbox( 12, 0, arial.ttf, "Hello World");
print_r($bird);
this gives no output. could someone help?
Can someone show me a basic imageftbbox function please because im having trouble getting it to work this is what ive tried so far
$bird = imageftbbox( 12, 0, arial.ttf, "Hello World");
print_r($bird);
this gives no output. could someone help?
Add quotes around font file name arial.ttf
like below:
$bird = imageftbbox( 12, 0, "arial.ttf", "Hello World");
Below output will come when you correct your code and display with print_r($bird);
:-
Array ( [0] => -1 [1] => -1 [2] => 77 [3] => -1 [4] => 77 [5] => -13 [6] => -1 [7] => -13 )
Also make sure arial.ttf
font exists in your root folder otherwise you need to give its complete path as described in PHP documentation like below:
Follow below link for more details :-
Thank You Amit Gupa your answer was very useful however i was still unable to get the code to work. a quick google search landed me on this page ( imagettftext function using font from remote server ) which helped me finally get the function to work.
$font = file_get_contents("http://themes.googleusercontent.com/static/fonts/abel/v3/RpUKfqNxoyNe_ka23bzQ2A.ttf");
file_put_contents("font.ttf", $font); //be sure to save the font in the path you have provided as font path.
$bird = imageftbbox( 12, 0, "font.ttf", "Hello World");
print_r($bird);