Unable to use GD library

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • resmi318
    New Member
    • Jun 2007
    • 29

    Unable to use GD library

    Hi,

    I wanted to draw some bar charts using php. I have enabled the line
    extension=php_g d2.dll in php.ini.
    Still not working.
    Should I include any path at the top of the script.
    What could be the problem?
    Pls help

    Thanks
    Resmi318
  • kovik
    Recognized Expert Top Contributor
    • Jun 2007
    • 1044

    #2
    What part of it isn't working?

    Is it in your phpinfo()?
    Does it tell you that GD functions don't exist?

    Comment

    • resmi318
      New Member
      • Jun 2007
      • 29

      #3
      Originally posted by volectricity
      What part of it isn't working?

      Is it in your phpinfo()?
      Does it tell you that GD functions don't exist?
      Hi,

      It didnt tell GD functions don't exist. When I run the script it is just showing a blank page.

      Resmi318

      Comment

      • kovik
        Recognized Expert Top Contributor
        • Jun 2007
        • 1044

        #4
        And what "script" are you running?

        Comment

        • Motoma
          Recognized Expert Specialist
          • Jan 2007
          • 3236

          #5
          Please take a look at the first post in this forum. It describes a method for receiving verbose error messages from PHP where you would normally get a black page.

          Post back the error message, as well as the relevant code. Believe me, as hard as it is for you to debug your problem, it is even more difficult for us to do so if we have no information to work with.

          Comment

          • kovik
            Recognized Expert Top Contributor
            • Jun 2007
            • 1044

            #6
            Okay, I don't want everyone PMing me for help. That's what the board is for. I have not read the script that you have sent me.

            However, I will give you a simple script to test if GD is, in fact, working.

            [code=php]$image = imagecreatetrue color(32, 32);
            imagefilledrect angle($image, 0, 0, 32, 32, imagecolorexact alpha($image, 0, 0, 0, 0));
            header('Content-Type: image/png');
            imagepng($image );[/code]

            You should get a 32x32 black box.

            Comment

            • Motoma
              Recognized Expert Specialist
              • Jan 2007
              • 3236

              #7
              Originally posted by volectricity
              Okay, I don't want everyone PMing me for help. That's what the board is for. I have not read the script that you have sent me.

              However, I will give you a simple script to test if GD is, in fact, working.

              [code=php]$image = imagecreatetrue color(32, 32);
              imagefilledrect angle($image, 0, 0, 32, 32, imagecolorexact alpha($image, 0, 0, 0, 0));
              header('Content-Type: image/png');
              imagepng($image );[/code]

              You should get a 32x32 black box.
              An easier test would be a simple call to gd_info().
              But before we go test every single little thing that may be causing this error, how about we see if the OP gets any error messages when the debugging is turned on.

              Comment

              • Motoma
                Recognized Expert Specialist
                • Jan 2007
                • 3236

                #8
                READ FIRST: Turn on PHP Debugging Messages

                Comment

                • kovik
                  Recognized Expert Top Contributor
                  • Jun 2007
                  • 1044

                  #9
                  Originally posted by Motoma
                  An easier test would be a simple call to gd_info().
                  But before we go test every single little thing that may be causing this error, how about we see if the OP gets any error messages when the debugging is turned on.
                  I was just responding to his PM. It's bad to assume your code is correct and blame other things. gd_info() is a much quicker solution. No idea why it didn't come to mind. Probably because the code he PMed to me was attempted to display an image, so I was thinking in the wrong context.

                  Comment

                  • resmi318
                    New Member
                    • Jun 2007
                    • 29

                    #10
                    Originally posted by volectricity
                    I was just responding to his PM. It's bad to assume your code is correct and blame other things. gd_info() is a much quicker solution. No idea why it didn't come to mind. Probably because the code he PMed to me was attempted to display an image, so I was thinking in the wrong context.
                    Hi,

                    I got the following error while I ran the script volectricity send me.

                    Fatal error: Call to undefined function: imagecreatetrue color()

                    Does that mean gd is not enabled or not present with php in my system.

                    But In php.ini file I saw gd library included ie the line
                    "extension=php_ gd2.dll"

                    Thanks
                    Resmi318

                    Comment

                    • kovik
                      Recognized Expert Top Contributor
                      • Jun 2007
                      • 1044

                      #11
                      It means that GD is not enabled. Are you sure that php_gd2.dll is in the correct dll path?

                      Comment

                      • nathj
                        Recognized Expert Contributor
                        • May 2007
                        • 937

                        #12
                        Hi Everyone,

                        I do not wish to hijack this post though I am aware that it may seem like I am. It's just that I need help with the exact same thing. I know that my gd2 stuff is enabled as phpInfo() tells me so (it says Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"). Also gd_info() shows me that stuff isd enabled:
                        [CODE=php]
                        $array = gd_info();
                        foreach ($array as $key => $val)
                        {
                        if ($key != "GD Version") {
                        if ($val == true || $val == false) {
                        if ($val == true) {
                        $val = "Enabled";
                        }
                        elseif ($val == false)
                        {
                        $val = "Disabled";
                        }
                        }
                        }

                        echo "$key: $val <br />";
                        [/CODE]

                        This returns :
                        Code:
                        GD Version: bundled (2.0.34 compatible) 
                        FreeType Support: Enabled 
                        FreeType Linkage: Enabled 
                        T1Lib Support: Enabled 
                        GIF Read Support: Enabled 
                        GIF Create Support: Enabled 
                        JPG Support: Enabled 
                        PNG Support: Enabled 
                        WBMP Support: Enabled 
                        XPM Support: Disabled 
                        XBM Support: Enabled 
                        JIS-mapped Japanese Font Support: Disabled
                        However, the code I have, which draws an image to be used as a security questions (slightly obscured text) works on a host I have for another project but I cannot get it to work locally. I need to have it working locally for testing purposes before I can move to the next stage of development.
                        Any ideas on what may be missing or incorrectly set up with the php_gd2 dll?
                        nathj

                        PS sorry for the hijack, it just seemed better than posting another thread about the same thing.

                        Comment

                        • ak1dnar
                          Recognized Expert Top Contributor
                          • Jan 2007
                          • 1584

                          #13
                          Originally posted by resmi318
                          Hi,

                          I got the following error while I ran the script volectricity send me.

                          Fatal error: Call to undefined function: imagecreatetrue color()

                          Does that mean gd is not enabled or not present with php in my system.

                          But In php.ini file I saw gd library included ie the line
                          "extension=php_ gd2.dll"

                          Thanks
                          Resmi318
                          Do you mean you saw that, is it commented yet?

                          Code:
                          ;extension=php_fdf.dll
                          ;extension=php_filepro.dll
                          [b] extension=php_gd2.dll[/b]
                          ;extension=php_gettext.dll
                          Have you located this php_gd2.dll under ext dir.

                          Comment

                          • resmi318
                            New Member
                            • Jun 2007
                            • 29

                            #14
                            Originally posted by volectricity
                            It means that GD is not enabled. Are you sure that php_gd2.dll is in the correct dll path?
                            Hi,

                            Actuallly I am not allowed to make changes in php.ini file. I have asked the administrator and he had taken the comment ";" infront of the statement
                            extension=php_g d2.dll and restarted the system. Still its not working.
                            I am using an unix machine .

                            Thanks
                            Resmi318

                            Comment

                            • Motoma
                              Recognized Expert Specialist
                              • Jan 2007
                              • 3236

                              #15
                              Originally posted by resmi318
                              Hi,

                              Actuallly I am not allowed to make changes in php.ini file. I have asked the administrator and he had taken the comment ";" infront of the statement
                              extension=php_g d2.dll and restarted the system. Still its not working.
                              I am using an unix machine .

                              Thanks
                              Resmi318
                              If you are on a UNIX machine, then you will not be using a dll, rather the extension file should end with .so.

                              Comment

                              Working...