greetings -

sorry to post this - but I have searched high and low and can't find any info related to this specifically.

I have downloaded php_gd.dll supposedly compiled for PHP4.0.4.

I am running PHP 4.0.4.pl1

I have copied the module to the ./extensions directory and changed the extensions_dir directive in the php.ini file to point to that directory.

I have un-commented the extension=php_gd.dll directive.

If I issue php -m I get the following:

Running PHP 4.0.4pl1
Zend Engine v1.0.4, Copyright (c) 1998-2000 Zend Technologies

[PHP Modules]
gd
standard
bcmath
Calendar
com
ftp
mysql
odbc
pcre
session
xml
wddx

[Zend Modules]

So it looks like the module has loaded fine...no error messages when php starts.

However...when I try to run a script that calls any of these functions, I get an error saying something like:

<br>
<b>Fatal error</b>: Call to undefined function: imagecreatefromgif() in <b>gddemo.php</b> on line <b>4</b><br>

Here's the code for the php script I was tring to execute:

<?php
Header("Content-type: image/gif");
$string=implode($argv," ");
$im = imagecreatefromgif
("images/button1.gif");
$orange = ImageColorAllocate($im, 220, 210, 60);
$px = (imagesx($im)-7.5*strlen($string))/2;
ImageString($im,3,$px,9,$string,$orange);
ImageGif($im);
ImageDestroy($im);
?>

any ideas? anyone? help!

Mark.

    GIF support was removed from gd in 1.6.

    Without using an earlier version of gd, you'll need to switch formats, I'd suggest using the PNG format.

    Best Regards,

    Kenneth Schwartz

      Thansk for the reply -

      This is not specific to any format. As soon as I call any function from php_gd.dll I get the same error. It looks like the library is not being referenced - but I don't know why - it looks like the module is loaded by php okay.

      Eaxmple:

      Calling imagecreate(200,200)in the following example gives me the same error:

      <?php
      // Header( "Content-type: image/png");
      Header( "Content-type: image/jpeg");

      / create image /
      $image = imagecreate(200,200);

      / create color R=100, G=0, R=0 /
      $maroon = ImageColorAllocate($image,100,0,0);

      / create color R=255, G=255, R=255 /
      $white = ImageColorAllocate($image,255,255,255);

      / create color green /
      $green = ImageColorAllocate($image,0,100,0);

      / create white background/
      ImageFilledRectangle($image,0,0,200,200,$white);

      / create frame/
      ImageRectangle($image,10,10,190,190,$maroon);

      / create inner rectangle/
      ImageFilledRectangle($image,50,70,150,150,$maroon);

      / display 5 fonts /
      for ($i=1; $i <= 5; $i++)
      ImageString($image,$i,15,$i*10,'php.weblogs.com',$green);

      / render image /
      // ImagePNG($image);
      ImageJPEG($image);

      / cleanup memory /
      ImageDestroy($image);
      ?>

      The error returned from this particular example is:
      <b>Fatal error</b>: Call to undefined function: imagecreate() in <b>htdocs/gddemo.php</b> on line <b>6

      Any more ideas? :-)

      Regards,

      Mark.

        A simpler solution might be to uninstall your PHP program altogether. Download PHP with a windows installer from "php.weblogs.com". This program installs PHP and creates th ephp.ini file with the options specific to your machine and setup.

          Howdy -

          Yeah - I tried that last ngiht and it worked sexy first time. Must obviously need to have the gd functionality compiled into PHP as well as having the dll loaded as a module. No documentation I could find made this clear.

          Thanks for your reply.

          Mark.

            mark and others,
            i also have the same problem. Can you solve the matter by uninstall everything back and reinstall back as suggested by sudhir anand?.

            WIll try to do it now.

            Ive had headaches for almost 2 weeks now about this matter.

            Any otehr ideas?

              Edy -

              yeah - I uninstalled the version I had that didn't work and downloaded the latest Windows Installer version from :

              http://php.weblogs.com/easywindows

              I just moved the PHP directory, ran the installer, selected GD support and rebooted. My script worked first time no problems.

              Ciao

              Mark.

                3 months later

                I'm trying to get the php_gd.dll to work with
                php 4.0.6 with no luck at all.

                I have tried all the suggestion other than loading an older version (4.0.4)

                Has anyone been able to get the module to load with 4.0.6

                Charles

                  9 months later

                  Thanks to all for your advise. Previously I've used PHP 4.1.2 and couldn't get the GD functions running (and still don't know why).
                  Now using the self-installing 4.0.4 version everything works fine.

                    Write a Reply...