Community & Support

The built-in GD image toolkit requires that the GD module for PHP be installed and configured properly. (Error or Warning?)

Just installed Drupal and I have this error/warning:

The built-in GD image toolkit requires that the GD module for PHP be installed and configured properly. For more information see http://php.net/image.

Is it an error or a warning? Do I need the GD image toolkit to use Drupal?

Comments

php module

Its a php module that was installed with every single provider i checked out so far. You need this for GD. An alternative is Imagemagick.

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

Ok, thanks.My host must not

Ok, thanks.

My host must not have it installed. Do I need GD to run Drupal? Can I use Drupal without it? I'm not sure why it is needed or wanted.

__________
Matthew Doucette / Xona.com

__________
Matthew Doucette / Xona.com

Don't need

It is not really necessary.
It is responsible for resizing, rotating ... images.
If you upload an image, the image.module will create a thumbnail view and a preview view, which are different sizes of the original.
If you upload your images by hand and put them into the html page by hand and if you don't want automatic image galleries you should be fine.
I don't know what level of access you have, but with shell access you should be able to install GD yourself (I think). In which case I would go for Imagemagick.

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

I have no level of access,

I have no level of access, except FTP. I do not think I will be using Drupal to modify images. I may have some screenshots (and thumbnails) of software products, but I can easily do this outside of Drupal.

So, from what I can see, I should be fine. Perhaps as I learn more about Drupal I will find GD to be useful and install it then.

Thanks.

__________
Matthew Doucette / Xona.com

__________
Matthew Doucette / Xona.com

Ask your webhost

You should ask your webhost to install it for you. It is a very common php application and therefore every host should have it.

Andre

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

The built-in GD image toolkit requires that the GD module for PHP be installed and configured properly. [Fix]

My host (being me) didn't have this installed. Since I was using a half-built Debian system, of which I now have 3 days Debian experience -- hence the length of this post, so I can find out what to do again next time!

Error on settings page (not many others):
The built-in GD image toolkit requires that the GD module for PHP be installed and

Fix:

  1. Check that php4-gd is installed. This can be done:
    <code>sudo apt-get install php4-gd
    Reading Package Lists... Done
    Building Dependency Tree... Done
    php4-gd is already the newest version.
  2. Turns out I'd installed it..

  3. Check it is set up: edit the php.ini file: (find it first)
    <code>whereis php4
    /etc/php4
    <code>sudo pico /etc/php4/apache/php.ini

    look for the lines:
    ;extension = gd.so;
    and uncomment:
    <code>extension = gd.so;
    There is probably (should be) a line extension=mysql.so; above this.

  4. Restart apache server
    <code>sudo apachectl restart

At this point, a refresh on the settings page and the error disappeared.

My system required me to update my apt /etc/apt/sources.list file with the sources I found on apt-get.org for Apache2 php5-gd.

sudo nano /etc/apt/sources.list

and modified to look like this:

deb http://security.debian.org/ stable/updates main contrib
deb http://http.us.debian.org/debian/ stable main contrib non-free
deb http://http.us.debian.org/debian/ testing main contrib non-free
deb http://http.us.debian.org/debian/ unstable main contrib non-free
deb http://security.debian.org/ stable/updates main contrib
deb http://http.us.debian.org/debian/ stable main contrib non-free
deb http://http.us.debian.org/debian/ testing main contrib non-free
deb http://http.us.debian.org/debian/ unstable main contrib non-free
deb-src http://http.us.debian.org/debian stable main contrib non-free
deb-src http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free
deb http://cobain.matteomoro.net/debian unstable/

Then I ran:

sudo apt-get update
sudo apt-get install php5-gd

Then I edited: sudo nano /etc/php5/apache2/php.ini, but extension = gd.so; was already uncommented on the last line of the file.

Then I restarted apache2, according to the guide on Apache configurations found here.

sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start

Then I was good to go.

ImageMagick config depends on GD being installed

FYI, I tried to configure Imagemagick as the image toolkit without having GD installed, and nothing happened, not even an error.

However, after I installed GD as above, I was able to set the image toolkit to Imagemagick.

I "fixed" the problem you

I "fixed" the problem you bring up by adding return TRUE; to the beginning of the function image_gd_check_settings()

It seems kind of bogus to me to require gd even when using imagemagick instead. OSX doesn't include gd in it's php builds and I don't feel like compiling it just to make drupal happy.

I searched far and wide to avoid having to recompile php to get the "needed" GD library working but using ImageMagick instead.
I am using latest CentOS 5.1 stock install and php does not enable gd lib. I am running Drupal 5.7.

I installed ImageMagick with Yum but could not set it as an option in Drupal until I did this hack:

/includes/image.inc
Function image_gd_check_settings() LINE 217
Changed:
return FALSE
To:
return TRUE
to disable the check for the GD lib. Doing this first allows you then to select ImageMagick as the image lib without GD installed.

Image uploads and thumbnail were now working but Drupal would still complain in system status about missing GD. Also the color module would not function and refused to display the color picker in the themes that support it.

I then did the following:
/modules/color/color.module
In function function color_form_alter() LINE 17
Changed:
if ($form_id == 'system_theme_settings' && color_get_info(arg(4)) && function_exists('gd_info') && variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) {
To:
if ($form_id == 'system_theme_settings' && color_get_info(arg(4)) && variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) {
Removing function_exists('gd_info')

I have come up with a hack which does the trick BUT this will be broken in the next update and should really be sorted in the Drupal core as Drupal DOES NOT REQUIRE the GD library if there is another one present and working.

Anyway for anyone else who is trying to get this to run, try this.

Installing the GD image library on PHP5

Thanks, that worked for me :-)

My fix:

1) sudo apt-get install php5-gd
2) sudo vim /etc/php5/apache2/php.ini

change:
;extension=gd.so
to:
extension=gd.so

3) sudo apache2ctl restart

sorted :-)