From 0ea653502c6bbe09ba90d9aba0dce69b9ca1291f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 9 Mar 2009 11:44:54 +0000 Subject: - Patch #373613 by quicksketch and drewish: in order to operate on images multiple times (such as crop, scale, then desaturate) without quality loss, we need to pass images by their raw GD (or other library) resources rather than re-opening the same image repeatedly, which causes wasted processing and loss of quality when using JPEG images. This patch reworks the image toolkits, adds some new image manipulations and adds some impressive SimpleTests. --- modules/system/system.api.php | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'modules/system/system.api.php') diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 8bdace642..7e77e7dcd 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -365,17 +365,40 @@ function hook_init() { } /** -* Define image toolkits provided by this module. -* -* The file which includes each toolkit's functions must be declared as part of -* the files array in the module .info file so that the registry will find and -* parse it. -* -* @return -* An array of image toolkit names. -*/ + * Define image toolkits provided by this module. + * + * The file which includes each toolkit's functions must be declared as part of + * the files array in the module .info file so that the registry will find and + * parse it. + * + * The toolkit's functions must be named image_toolkitname_operation(). + * where the operation may be: + * - 'load': Required. See image_gd_load() for usage. + * - 'save': Required. See image_gd_save() for usage. + * - 'settings': Optional. See image_gd_settings() for usage. + * - 'resize': Optional. See image_gd_resize() for usage. + * - 'crop': Optional. See image_gd_crop() for usage. + * - 'desaturate': Optional. See image_gd_desaturate() for usage. + * + * @return + * An array with the toolkit name as keys and sub-arrays with these keys: + * - 'title': A string with the toolkit's title. + * - 'available': A Boolean value to indicate that the toolkit is operating + * properly, e.g. all required libraries exist. + * + * @see system_image_toolkits() + */ function hook_image_toolkits() { - return array('gd'); + return array( + 'working' => array( + 'title' => t('A toolkit that works.'), + 'available' => TRUE, + ), + 'broken' => array( + 'title' => t('A toolkit that is "broken" and will not be listed.'), + 'available' => FALSE, + ), + ); } /** -- cgit v1.2.3