diff options
Diffstat (limited to 'includes/image.inc')
-rw-r--r-- | includes/image.inc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/includes/image.inc b/includes/image.inc index fb3689d71..5013d09a3 100644 --- a/includes/image.inc +++ b/includes/image.inc @@ -177,11 +177,24 @@ function image_crop($source, $destination, $x, $y, $width, $height) { */ /** - * Retrieve settings for the GD2 toolkit (not used). + * Retrieve settings for the GD2 toolkit. */ function image_gd_settings() { if (image_gd_check_settings()) { - return t('The built-in GD2 toolkit is installed and working properly.'); + $form = array(); + $form['status'] = array('#value' => t('The built-in GD2 toolkit is installed and working properly.')); + + $form['image_jpeg_quality'] = array( + '#type' => 'textfield', + '#title' => t('JPEG quality'), + '#description' => t('Define the image quality for JPEG manipulations. Ranges from 0 to 100. Higher values mean better image quality but bigger files.'), + '#size' => 10, + '#maxlength' => 3, + '#default_value' => variable_get('image_jpeg_quality', 75), + '#field_suffix' => t('%'), + ); + + return $form; } 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 <a href="@url">PHP\'s image documentation</a>.', array('@url' => 'http://php.net/image'))); @@ -304,7 +317,12 @@ function image_gd_close($res, $destination, $extension) { if (!function_exists($close_func)) { return FALSE; } - return $close_func($res, $destination); + if ($extension == 'jpeg') { + return $close_func($res, $destination, variable_get('image_jpeg_quality', 75)); + } + else { + return $close_func($res, $destination); + } } |