Index: includes/image.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/image.inc,v
retrieving revision 1.2
diff -u -r1.2 image.inc
--- includes/image.inc	21 Feb 2005 04:16:46 -0000	1.2
+++ includes/image.inc	23 Mar 2005 18:43:37 -0000
@@ -18,7 +18,7 @@
       $output[$info['name']] = $info['title'];
     }
   }
-  $output['gd'] = t('Built-in GD Toolkit');
+  $output['gd'] = t('Built-in GD 2 Toolkit');
   return $output;
 }
 
@@ -30,11 +30,12 @@
 function image_get_toolkit() {
   static $toolkit;
   if (!$toolkit) {
-    $toolkit = variable_get('image_toolkit', 'gd');
-    if ($toolkit != 'gd') {
-      include_once 'includes/image.'. $toolkit .'.inc';
+    $toolkit = variable_get('image_toolkit', 'gd2');
+    $toolkit_file = 'includes/image.'.$toolkit.'.inc';
+    if ($toolkit != 'gd' && file_exists($toolkit_file)) {
+      include_once $toolkit_file;
     }
-    elseif (!image_gd_settings()) {
+    elseif (!image_gd_check_settings()) {
       $toolkit = false;
     }
   }
@@ -57,7 +58,13 @@
       return call_user_func_array($function, $params);
     }
     else {
-      drupal_set_message(t('%method is not supported by %toolkit.', array('%method' => "<em>$method</em>", '%toolkit' => "<em>$toolkit</em>")));
+      watchdog('php', t("The selected image handling toolkit '%toolkit' can not correctly process '%function'.", array('%toolkit' => "<em>$toolkit</em>", '%function' => "<em>$function</em>")), WATCHDOG_ERROR);
+      return false;
+    }
+  }
+  else {
+    if ($method == 'settings') {
+      return image_gd_settings();
     }
   }
 }
@@ -161,18 +168,36 @@
 }
 
 /**
- * GD Toolkit functions
+ * GD 2 Toolkit functions
+ * With the minimal requirements of PHP 4.3 for Drupal, we use the build-in version of GD 2.0
  */
 
 /**
- * Verify GD settings (that the extension is actually installed).
+ * Retrieve settings for the GD toolkit (not used)
  */
 function image_gd_settings() {
-  if (!extension_loaded('gd')) {
-    drupal_set_message(t('Unable to load the GD toolkit'), 'error');
+  if (image_gd_check_settings()) {
+    return t('The GD toolkit is installed and working properly');
+  }
+  else {
+    form_set_error('image_toolkit', t("The built-in GD2 toolkit requires that the GD module for PHP be installed and configured properly. For more information see %url", array('%url' => '<a href="http://php.net/image">http://php.net/image</a>')));
     return false;
   }
-  return true;
+}
+
+/**
+ * Verify GD 2 settings (that the right version is actually installed).
+ *
+ * @return boolean
+ */
+function image_gd_check_settings() {
+  if ($check = get_extension_funcs('gd')) {
+    if (in_array('imagegd2', $check)) {
+      // GD 2 support
+      return true;
+    }
+  }
+  return false;
 }
 
 /**
@@ -193,21 +218,9 @@
     return false;
   }
 
-  // GD1 doesn't have true color
-  if (function_exists('imageCreateTrueColor')) {
-    $res = imageCreateTrueColor($width, $height);
-  }
-  else {
-    $res = imageCreate($width, $height);
-  }
-
-  // GD1 doesn't have copyResampled
-  if (function_exists('imageCopyResampled')) {
-    imageCopyResampled($res, $im, 0, 0, 0, 0, $width, $height, $info['width'], $info['height']);
-  }
-  else {
-    imageCopyResized($res, $im, 0, 0, 0, 0, $width, $height, $info['width'], $info['height']);
-  }
+  $res = imageCreateTrueColor($width, $height);
+  // TODO: merge copy
+  imageCopyResampled($res, $im, 0, 0, 0, 0, $width, $height, $info['width'], $info['height']);
   $result = image_gd_close($res, $destination, $info['extension']);
 
   imageDestroy($res);
@@ -235,7 +248,6 @@
   }
 
   $res = imageRotate($im, $degrees, $bg_color);
-
   $result = image_gd_close($res, $destination, $info['extension']);
 
   return $result;
@@ -251,17 +263,8 @@
   }
 
   $im = image_gd_open($source, $info['extension']);
-
-  // GD1 doesn't have true color
-  if (function_exists('imageCreateTrueColor')) {
-    $res = imageCreateTrueColor($width, $height);
-  }
-  else {
-    $res = imageCreate($width, $height);
-  }
-
+  $res = imageCreateTrueColor($width, $height);
   imageCopy($im, $res, 0, 0, $x, $y, $width, $height);
-
   $result = image_gd_close($res, $destination, $info['extension']);
 
   imageDestroy($res);
Index: modules/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system.module,v
retrieving revision 1.201
diff -u -r1.201 system.module
--- modules/system.module	21 Mar 2005 21:25:49 -0000	1.201
+++ modules/system.module	23 Mar 2005 18:43:37 -0000
@@ -240,12 +240,10 @@
   // image handling:
   $group = '';
   $toolkits_available = image_get_available_toolkits();
-  if (count($toolkits_available) > 1) {
-    $group .= form_radios(t('Select an image processing toolkit'), 'image_toolkit', variable_get('image_toolkit', image_get_toolkit()), $toolkits_available);
-    $group .= image_toolkit_invoke('settings');
-  }
-  else {
-    $group .= t('<p>No image toolkits are installed.</p>');
+  $group .= form_radios(t('Select an image processing toolkit'), 'image_toolkit', variable_get('image_toolkit', image_get_toolkit()), $toolkits_available);
+  $group .= image_toolkit_invoke('settings');
+  if ($group) {
+    $output .= form_group(t('Image handling'), $group, t('For additional image processing toolkits please see %url', array('%url' => '<a href="http://drupal.org/project/image">http://drupal.org/project/image</a>')));
   }
 
   $output .= form_group(t('Image handling'), $group);
