GD Library working on local machine but not hosts!!

Discussion in 'PHP' started by fireflyproject, Mar 22, 2008.

  1. #1
    Right, so I'm having an issue with the GD library...

    To start, here is my code, very simple.

    $string1 = $_GET['string1']; // lets get the text from the form
    $string2 = $_GET['string2']; // lets get the text from the form
    
    // define what image we want to write on
    $im = imagecreatefromjpeg("images/thermostat.jpg");
    
    // define the text color, red, green, blue
    $textcolor = imagecolorallocate($im, 61, 61, 61);
    
    //$font = imageloadfont('DS-DIGI.TTF'); // tells it what font to use
    
    ImageTTFText ($im, 45, 0, 142, 125, $txt_color, "DS-DIGI.ttf", $string1);
    ImageTTFText ($im, 45, 0, 142, 180, $txt_color, "DS-DIGI.ttf", $string2);
    //imagestring($im, $font, 175, 395, $string, $textcolor); // line o'text
    
    // header to tell the browser it's an image
    header("Content-type: image/jpeg");
    
    imagejpeg($im); // creates the image with text
    
    imagedestroy($im); // destroys the image in the memory
    ?>
    Code (markup):
    This code is supposed to print out $string1 and $string2 onto the image... It works perfectly on my local machine, however on my Dreamhost server... not so much. Both of them run GD2.

    Any ideas?
     
    fireflyproject, Mar 22, 2008 IP
  2. fireflyproject

    fireflyproject Active Member

    Messages:
    969
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    70
    #2
    Nevermind...

    I just needed to capitilize the .ttf because it's in UNIX instead of on this windows computer.
     
    fireflyproject, Mar 22, 2008 IP