Gd & freetype library problem

Discussion in 'PHP' started by Balamurali, Nov 16, 2008.

  1. #1
    Hai all i am using gd library to generate text image in png format using arial.ttf font file. Its working in localhost, its not working in server, Because of Gd library. In the server Gd library is enabled, but still its not working. imagettftext function required gd library and freetype. But in the server there is no option to enable the freetype. How to enable it ?

    <?php
    // Set the content-type
    header('Content-type: image/png');

    // Create the image
    $im = imagecreatetruecolor(400, 30);

    // Create some colors
    $white = imagecolorallocate($im, 255, 255, 255);
    $grey = imagecolorallocate($im, 128, 128, 128);
    $black = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 0, 0, 399, 29, $white);

    // The text to draw
    $text = 'Hai World';
    // Replace path by your own font path
    $font = 'arial.ttf';

    // Add some shadow to the text
    imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

    // Add the text
    imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

    // Using imagepng() results in clearer text compared with imagejpeg()
    imagepng($im);
    imagedestroy($im);
    ?>


    Thanks in advance.
     
    Balamurali, Nov 16, 2008 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    how do you set your freetype in your local?
    why not declaring a function ini_set() and set to "on" your freetype
     
    bartolay13, Nov 16, 2008 IP