Index: modules/system/image.gd.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/image.gd.inc,v
retrieving revision 1.15
diff -u -r1.15 image.gd.inc
--- modules/system/image.gd.inc 30 Jan 2010 07:59:25 -0000 1.15
+++ modules/system/image.gd.inc 28 Mar 2010 18:48:05 -0000
@@ -12,7 +12,10 @@
*/
/**
- * Retrieve settings for the GD2 toolkit.
+ * Retrieves settings for the GD2 toolkit.
+ *
+ * @return
+ * SOMETHING SOMETHING
*/
function image_gd_settings() {
if (image_gd_check_settings()) {
@@ -30,17 +33,36 @@
'#field_suffix' => t('%'),
);
$form['#element_validate'] = array('image_gd_settings_validate');
-
- return $form;
}
else {
- form_set_error('image_toolkit', t('The GD image toolkit requires that the GD module for PHP be installed and configured properly. For more information see PHP\'s image documentation.', array('@url' => 'http://php.net/image')));
- return FALSE;
+ $form['#after_build'] = array('image_gd_settings_missing');
+ }
+ return $form;
+}
+
+/**
+ * NEEDS A COMMENT
+ *
+ * @param $form
+ * @param $form_state
+ *
+ * @return
+ */
+function image_gd_settings_missing($form, $form_state) {
+ // Don't report errors if another toolkit is being selected.
+ if (!isset($form['#post']['image_toolkit']) || $form['#post']['image_toolkit'] == 'gd') {
+ 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 PHP\'s image documentation.', array('@url' => 'http://php.net/image')));
}
+ return $form;
}
/**
- * Validate the submitted GD settings.
+ * Validates the submitted GD settings.
+ *
+ * @param $form
+ * @param $form_state
+ *
+ * @return
*/
function image_gd_settings_validate($form, &$form_state) {
// Validate image quality range.
@@ -51,7 +73,7 @@
}
/**
- * Verify GD2 settings (that the right version is actually installed).
+ * Verifies GD2 settings (that the right version is actually installed).
*
* @return
* A boolean indicating if the GD toolkit is available on this machine.
@@ -67,7 +89,7 @@
}
/**
- * Scale an image to the specified size using GD.
+ * Scales an image to the specified size using GD.
*
* @param $image
* An image object. The $image->resource, $image->info['width'], and
@@ -97,7 +119,7 @@
}
/**
- * Rotate an image the given number of degrees.
+ * Rotates an image the given number of degrees.
*
* @param $image
* An image object. The $image->resource, $image->info['width'], and
@@ -110,6 +132,7 @@
* 0xff00ff for magenta, and 0xffffff for white. For images that support
* transparency, this will default to transparent. Otherwise it will
* be white.
+ *
* @return
* TRUE or FALSE, based on success.
*
@@ -167,7 +190,7 @@
}
/**
- * Crop an image using the GD toolkit.
+ * Crops an image using the GD toolkit.
*
* @param $image
* An image object. The $image->resource, $image->info['width'], and
@@ -180,6 +203,7 @@
* The width of the cropped area, in pixels.
* @param $height
* The height of the cropped area, in pixels.
+ *
* @return
* TRUE or FALSE, based on success.
*
@@ -201,12 +225,13 @@
}
/**
- * Convert an image resource to grayscale.
+ * Converts an image resource to grayscale.
*
* Note that transparent GIFs loose transparency when desaturated.
*
* @param $image
* An image object. The $image->resource value will be modified by this call.
+ *
* @return
* TRUE or FALSE, based on success.
*
@@ -227,6 +252,7 @@
*
* @param $image
* An image object. The $image->resource value will populated by this call.
+ *
* @return
* TRUE or FALSE, based on success.
*
@@ -247,13 +273,15 @@
* A string file path where the image should be saved.
* @param $extension
* A string containing one of the following extensions: gif, jpg, jpeg, png.
+ *
* @return
* TRUE or FALSE, based on success.
*
* @see image_save()
*/
function image_gd_save(stdClass $image, $destination) {
- // Convert URI to a normal path because PHP apparently has some gaps in stream wrapper support.
+ // Convert URI to a normal path because PHP apparently has some gaps in stream
+ // wrapper support.
if ($wrapper = file_stream_wrapper_get_instance_by_uri($destination)) {
$destination = $wrapper->realpath();
}
@@ -277,7 +305,7 @@
}
/**
- * Create a truecolor image preserving transparency from a provided image.
+ * Creates a truecolor image preserving transparency from a provided image.
*
* @param $image
* An image object.
@@ -285,6 +313,7 @@
* The new width of the new image, in pixels.
* @param $height
* The new height of the new image, in pixels.
+ *
* @return
* A GD image handle.
*/
@@ -320,17 +349,18 @@
}
/**
- * Get details about an image.
+ * Gets details about an image.
*
* @param $image
* An image object.
+ *
* @return
* FALSE, if the file could not be found or is not an image. Otherwise, a
* keyed array containing information about the image:
- * - "width": Width, in pixels.
- * - "height": Height, in pixels.
- * - "extension": Commonly used file extension for the image.
- * - "mime_type": MIME type ('image/jpeg', 'image/gif', 'image/png').
+ * - width: Width, in pixels.
+ * - height: Height, in pixels.
+ * - extension: Commonly used file extension for the image.
+ * - mime_type: MIME type ('image/jpeg', 'image/gif', 'image/png').
*
* @see image_get_info()
*/