-2

I have my code

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


$white = imagecolorallocate($background, 255, 255, 255);
$fontfile = "tahoma.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);

?>

And its getting error

Fatal error: Call to undefined function imagettftext() in /home/xx/public_html/x.com/x/id.php on line 13

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
user3232086
  • 11
  • 1
  • 5

1 Answers1

0

Your error is:

Fatal error: Call to undefined function imagettftext()…

Which means your install of PHP does not have—or cannot use—imagettftext(). And as the PHP manual states:

This function requires both the GD library and the FreeType library.

Check your PHP install you can use phpinfo by setting up a PHP file named phpinfo.php and simply place this inside it:

<?php
phpinfo();
?>

Then open up that URL in your web browser like so:

http://my_web.host/phpinfo.php

And look for the GD library info.

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
  • 1
    Just edited my answer with info on `phpinfo`. But in general you cannot rely on tools like cPanel to save you in cases like this. They simply present an extremely simplified view of a server setup. Maybe cPanel can tell you what PHP modules you have installed, but the pure `phpinfo` method works best. – Giacomo1968 May 01 '14 at 04:20