DrupalSetting up a gallery in Drupal may easily turn into a lot of hassle. While Drupal is one of the most flexible Content Management Systems out there, it’s also one of the most complex on top of million modules for pretty much everything including the functionality for the simple gallery.

There are several combinations of modules to get a themed gallery going in Drupal 6. One such way is by using following:

Problems with ImageAPI and ImageCache

The above set provides a rather flexible platform but since all modules are at different development stages, they might not work together. In the circumstances, with ImageAPI 6.x-1.6 and ImageCache 6.x-2.0-beta9 it’s likely to throw an error:

imagecopyresampled(): supplied argument is not
a valid Image resource in
/home/.../sites/all/modules/imageapi/imageapi_gd.module
on line 126.

Same happens to the alternative ImageMagick processing.

Workaround for ImaegAPI and ImageCache

Fortunately the workaround is rather trivial:

  1. Open Drupal settings at /sites/default/settings.php
  2. Find PHP settings block in the code around ln 148 and paste the line ini_set('zend.ze1_compatibility_mode', 0); to disable PHP 4 compatibility mode.

Since FileField module sets the requirement for PHP 5 already, you don’t really have to worry about the compatibility mode with Zend Engine 1 (PHP 4).

Related resources: