summaryrefslogtreecommitdiff
path: root/modules/system/system.admin.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-03-09 11:44:54 +0000
committerDries Buytaert <dries@buytaert.net>2009-03-09 11:44:54 +0000
commit0ea653502c6bbe09ba90d9aba0dce69b9ca1291f (patch)
tree20d6918349bd4938e2cf972fa73e012ebf3f46ee /modules/system/system.admin.inc
parent3faf46dcb0d092d735d6dafaa3760bf4f7826350 (diff)
downloadbrdo-0ea653502c6bbe09ba90d9aba0dce69b9ca1291f.tar.gz
brdo-0ea653502c6bbe09ba90d9aba0dce69b9ca1291f.tar.bz2
- 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.
Diffstat (limited to 'modules/system/system.admin.inc')
-rw-r--r--modules/system/system.admin.inc20
1 files changed, 17 insertions, 3 deletions
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index ecc15e3a8..2e24cf8d3 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -1462,19 +1462,33 @@ function system_file_system_settings() {
*/
function system_image_toolkit_settings() {
$toolkits_available = image_get_available_toolkits();
+ $current_toolkit = image_get_toolkit();
+
+ if (count($toolkits_available) == 0) {
+ variable_del('image_toolkit');
+ $form['image_toolkit_help'] = array(
+ '#markup' => t("No image toolkits were detected. Drupal includes support for <a href='!gd-link'>PHP's built-in image processing functions</a> but they were not detected on this system. You should consult your system administrator to have them enabled, or try using a third party toolkit.", array('gd-link' => url('http://php.net/gd'))),
+ );
+ return $form;
+ }
+
if (count($toolkits_available) > 1) {
$form['image_toolkit'] = array(
'#type' => 'radios',
'#title' => t('Select an image processing toolkit'),
- '#default_value' => image_get_toolkit(),
+ '#default_value' => $current_toolkit,
'#options' => $toolkits_available
);
}
- elseif (count($toolkits_available) == 1) {
+ else {
variable_set('image_toolkit', key($toolkits_available));
}
- $form['image_toolkit_settings'] = image_toolkit_invoke('settings');
+ // Get the toolkit's settings form.
+ $function = 'image_' . $current_toolkit . '_settings';
+ if (drupal_function_exists($function)) {
+ $form['image_toolkit_settings'] = $function();
+ }
return system_settings_form($form, TRUE);
}