### Eclipse Workspace Patch 1.0
#P drupal5
Index: sites/all/modules/imagecache/imagecache.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.module,v
retrieving revision 1.19.2.14
diff -u -r1.19.2.14 imagecache.module
--- sites/all/modules/imagecache/imagecache.module	1 Feb 2007 06:48:50 -0000	1.19.2.14
+++ sites/all/modules/imagecache/imagecache.module	21 Feb 2007 21:53:42 -0000
@@ -53,6 +53,59 @@
   return $items;
 }
 
+/**
+ * Implementation of hook_requirements
+ */
+function imagecache_requirements($phase) {
+  $requirements = array();
+  // Ensure translations don't break at install time
+  $t = get_t();
+
+  if ($phase == 'runtime') {
+    // Clean URLS
+    if (!variable_get('clean_url', 0)) {
+      $requirements['clean_urls'] = array(
+        'title' => $t('Clean URLs'),
+        'value' => $t('Not enabled'),
+        'severity' => REQUIREMENT_ERROR,
+        'description' => $t('Imagecache will not operate properly if <a href="!url">Clean URLs</a> is not enabled on your site.', array('!url' => url('admin/settings/clean-urls'))),
+      ); 
+    }
+    // Check for an image library
+    if (count(image_get_available_toolkits()) == 0) {
+      $requirements['clean_urls'] = array(
+        'title' => $t('Image Toolkit'),
+        'value' => $t('No image toolkits available'),
+        'severity' => REQUIREMENT_ERROR,
+        'description' => $t('Imagecache requires an imagetoolkit such as <a href="http://php.net/gd">GD2</a> or <a href="http://www.imagemagick.org">Imagemagick</a> be installed on your server.'),
+      ); 
+    }
+    // Check for public files
+    if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
+      $requirements['file_system'] = array(
+        'title' => $t('File Download Method'),
+        'value' => $t('Private Downloads'),
+        'severity' => REQUIREMENT_ERROR,
+        'description' => $t('Imagecache will not operate properly using Private Files. Please enable <a href="!url">Public File Transfer</a>.', array('!url' => url('admin/settings/file-system'))),
+      ); 
+    }
+    // Check for jpeg/png/gif support
+    if ('gd' == image_get_toolkit()) {
+      foreach (array('gif', 'jpeg', 'png') as $format) {
+        if (!function_exists('imagecreatefrom' . $format)) {
+          $requirements['gd_' . $format] = array(
+            'title' => $t('GD !format Support', array('!format' => drupal_ucfirst($format))),
+            'value' => $t('Not installed'),
+            'severity' => REQUIREMENT_INFO,
+            'description' => $t('PHP was not compiled with %format support. Imagecache will not be able to process %format images.', array('%format' => $format)), 
+          );
+        }
+      } 
+    }
+  }
+
+  return $requirements;
+}
 
 function imagecache_cache() {
   $generated = FALSE;
