[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1032
  • Last Modified:

PHP/GD2: undefined function imagettftext()

Hello,

I have a PHP script that works perfectly on one server but causes a fatal error on another:

        Fatal error: Call to undefined function imagettftext() on line 8

Both have GD2 installed.  I use PHP 5.2.4.  Any ideas why this is not working?  Here is my script:


<?php

print_r (better_imagettfbbox ('12', '44', 'arial.ttf', 'Hello World'));

function better_imagettfbbox($size, $angle, $font, $text) {
  $dummy = imagecreate(1, 1);
  $black = imagecolorallocate($dummy, 0, 0, 0);
  $bbox = imagettftext($dummy, $size, $angle, 0, 0, $black, $font, $text);
  imagedestroy($dummy);
  return $bbox;
}
?>
0
hankknight
Asked:
hankknight
2 Solutions
 
ahincCommented:
imagettftext() requires the Freetype lib. Check that you have this installed as well.
0
 
hernst42Commented:
on a unix server the gd must be compiled with the option --enable-gd-native-ttf Check your phpinfo() for compile options. On windows the function is mormaly available if gs is loaded.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now