? 295854-image-check-function-D6.patch
Index: includes/image.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/image.inc,v
retrieving revision 1.24
diff -u -p -r1.24 image.inc
--- includes/image.inc	28 Jan 2008 16:05:17 -0000	1.24
+++ includes/image.inc	18 Aug 2010 18:28:45 -0000
@@ -67,8 +67,19 @@ function image_get_toolkit() {
     if (isset($toolkit) && file_exists($toolkit_file)) {
       include_once $toolkit_file;
     }
-    elseif (!image_gd_check_settings()) {
-      $toolkit = FALSE;
+    else {
+      // Attempt to explicitly fall back to GD for this request.
+      if ($toolkit_file = './includes/image.gd.inc' && file_exists($toolkit_file)) {
+        include_once $toolkit_file;
+        if (image_gd_check_settings()) {
+          watchdog('php', 'Image handling toolkit %toolkit selected, but %toolkit_file could not be loaded. Automatically falling back to GD toolkit for remainder of request.', array('%toolkit' => $toolkit, '%toolkit_file'), WATCHDOG_ERROR);
+          $toolkit = 'gd';
+        }
+        else {
+          watchdog('php', 'Image handling toolkit %toolkit selected, but %toolkit_file could not be loaded.', array('%toolkit' => $toolkit, '%toolkit_file'), WATCHDOG_ERROR);
+          $toolkit = FALSE;
+        }
+      }
     }
   }
 
