Jump to content

[SOLVED] Call to undefined function: imagettftext() error


dsaba

Recommended Posts

hello everyone i'm getting this error:

<b>Fatal error</b>:  Call to undefined function:  imagettftext()

 

this the the code i'm running:

<?PHP
$background1 = "/images/background.png";
$avatar1 = "/images/avatar.png";
$background = imagecreatefrompng($background1);
$avatar = imagecreatefrompng($avatar1);
imagecopymerge($background, $avatar, 5, 28, 0, 0, 70, 67, 100);


$white = imagecolorallocate($background, 255, 255, 255);
$fontfile = "/fonts/varsity_regular.ttf";
$string = "Superdude1";
//imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code) or die('Error in imagettftext function');
imagettftext($background, 12, 0, 3, 17, $white, $fontfile, $string);


imagepng($background, "usercard.png");
imagedestroy($background);
imagedestroy($avatar);

?>

 

How can I fix it? Why am I getting the error?

NEW PROBLEM IGNORE THE OTHER POSTS READ THIS ONE!

ok obviously freetype support isn't there in my phpinfo good news is I found a host that supports it

 

however now I get this error:

Warning: imagettftext(): Could not find/open font

 

are there only certain fonts that you can use with this function?

 

as you can see in my above code I used this font:

$fontfile = "/fonts/varsity_regular.ttf";

 

 

and the font IS NOT in the same directory it is in /fonts, is that also a problem?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.