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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.