Index: modules/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/Attic/system.module,v
retrieving revision 1.320.2.15
diff -u -p -r1.320.2.15 system.module
--- modules/system.module 12 Dec 2006 21:49:13 -0000 1.320.2.15
+++ modules/system.module 12 Dec 2006 22:28:36 -0000
@@ -379,7 +379,8 @@ function system_view_general() {
$form['image'] = array('#type' => 'fieldset', '#title' => t('Image handling'), '#collapsible' => TRUE, '#collapsed' => true);
$form['image']['image_toolkit'] = array(
'#type' => 'radios', '#title' => t('Select an image processing toolkit'),
- '#default_value' => variable_get('image_toolkit', image_get_toolkit()), '#options' => $toolkits_available
+ '#default_value' => variable_get('image_toolkit', image_get_toolkit()), '#options' => $toolkits_available,
+ '#validate' => array('image_toolkit_validate' => array('image_toolkit', 'image_toolkit')),
);
$form['image']['settings'] = image_toolkit_invoke('settings');
}
Index: includes/image.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/image.inc,v
retrieving revision 1.12.2.2
diff -u -p -r1.12.2.2 image.inc
--- includes/image.inc 12 Dec 2006 01:04:21 -0000 1.12.2.2
+++ includes/image.inc 12 Dec 2006 22:28:39 -0000
@@ -44,6 +44,15 @@ function image_get_toolkit() {
}
/**
+ * Validates toolkit selection.
+ */
+function image_toolkit_validate($formelement, $fieldname) {
+ if ($formelement['#value'] == 'gd' && image_gd_check_settings() == false) {
+ form_set_error('image_toolkit', t("The built-in GD image toolkit requires that the GD module for PHP be installed and configured properly. For more information see %url.", array('%url' => 'http://php.net/image')));
+ }
+}
+
+/**
* Invokes the given method using the currently selected toolkit.
*
* @param $method A string containing the method to invoke.
@@ -181,11 +190,10 @@ function image_crop($source, $destinatio
*/
function image_gd_settings() {
if (image_gd_check_settings()) {
- return t('The built-in GD2 toolkit is installed and working properly.');
+ return array('#type' => 'item', '#value' => t('The built-in GD2 toolkit is installed and working properly.'));
}
else {
- form_set_error('image_toolkit', t("The built-in GD image toolkit requires that the GD module for PHP be installed and configured properly. For more information see %url.", array('%url' => 'http://php.net/image')));
- return false;
+ return array('#type' => 'item', '#value' => t('The built-in GD image toolkit requires that the GD module for PHP be installed and configured properly. For more information see %url.', array('%url' => l('http://php.net/image', 'http://php.net/image'))));
}
}