Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26

Thread: Gd

  1. #11
    Join Date
    Feb 2006
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    No change.

    At php.net it shows a table about image formats. And it shows a couple libraries to download for each format. Do i need those downloaded too? And the Font libraries?

  2. #12
    Join Date
    Feb 2006
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh, i think i'm onto something here, before i put the error_all thing that you suggested, and before i took out the header, the image was just the box with an X in it. So i was reading at php.net, and it says that to put the image in png format you need to donwload another library. well in my script the image is output as a png. So i tried instead of using imagepng($im) i used imagejpeg($im), but still just a box with an X.

  3. #13
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The box with the X just means that your script isn't actually outputting a perfectly-formed image. Can you post the script?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #14
    Join Date
    Feb 2006
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Allright, well this code i took from www.php.net to test my computer and see if i had the GD thing properly installed and whatnot, so i don't really understand it, and that may be why my image wont show.

    Code:
    <?php
    header("Content-type: image/png");
    $im = @imagecreate(100, 50)
       or die("Cannot Initialize new GD image stream");
    $background_color = imagecolorallocate($im, 255, 255, 255);
    $text_color = imagecolorallocate($im, 233, 14, 91);
    imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
    imagejpeg($im);
    imagedestroy($im);
    ?>

  5. #15
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Well, that looks fine to me. Find out where your php_gd2.dll file resides, and check that your php.ini points to it correctly.

    /EDIT: Actually, try this first:
    Code:
    <?php if(function_exists('imagecreate')) die('GD is working.'); else die('GD isn't working.'); ?>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #16
    Join Date
    Feb 2006
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The page is now blank again.
    The directory is pointed in the right place for where php_gd2.dll is located.
    I tried changing the code to see if my page would change to be the box with the X instead of blank. Here's my code now:

    Code:
    <?php
    
    $im = imagecreate(100, 100);
    
    $string = 'PHP';
    
    $bg = imagecolorallocate($im, 255, 255, 255);
    $black = imagecolorallocate($im, 0, 0, 0);
    
    // prints a black "P" in the top left corner
    imagechar($im, 1, 0, 0, $string, $black);
    
    header('Content-type: image/png');
    imagepng($im);
    
    ?>
    <?php if(function_exists('imagecreate')) { die('GD is working.');} else { die('GD isn't working.');} ?>
    Again, that was taken from www.php.net since i dont know how to script it quite yet.

  7. #17
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No no, not after the rest of the code, I intended you to put that code in a separate page.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #18
    Join Date
    Feb 2006
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh.
    Hahah, I didn't catch this before: the code you told me to put in was missing something, no wonder it didnt work.

    Code:
    <?php if(function_exists('imagecreate')) { die('GD is working.');} else { die('GD isn't working.');} ?>
    The second die() function - 'isn\'t'. Hehe, no wonder it wasn't working.

    Anyway, i put that code in a separate page, and it turns out GD isn't working.

  9. #19
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Whoops, yeah, sorry.

    Where is php_gd2.dll? What are the pertinent lines of php.ini?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #20
    Join Date
    Feb 2006
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I dont know what pertinant means, but i'm assuming you want to see the lines in my php.ini that show you exactly where GD is located:

    Code:
    extension_dir = "c:\web\php\extensions"
    then later in php.ini

    Code:
    extension=php_gd2.dll
    and thats it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •