diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-15 10:17:42 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-15 10:17:42 +0000 |
commit | 1b2ce46df2f11783fb766f3d3811dab1c4acb986 (patch) | |
tree | a1ef59acb694ee6cff9b9f794782e206273bc412 /includes | |
parent | 63a15b383c27139b5544810f0b6105777165fd19 (diff) | |
download | brdo-1b2ce46df2f11783fb766f3d3811dab1c4acb986.tar.gz brdo-1b2ce46df2f11783fb766f3d3811dab1c4acb986.tar.bz2 |
#201540 follow up by zoo33: move jpeg quality validation to where it belongs, so it is only called if the current image toolkit requires it
Diffstat (limited to 'includes')
-rw-r--r-- | includes/image.gd.inc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/includes/image.gd.inc b/includes/image.gd.inc index 7ae60dcf1..de887e35f 100644 --- a/includes/image.gd.inc +++ b/includes/image.gd.inc @@ -37,7 +37,8 @@ function image_gd_settings() { '#default_value' => variable_get('image_jpeg_quality', 75), '#field_suffix' => t('%'), ); - + $form['#element_validate'] = array('image_gd_settings_validate'); + return $form; } else { @@ -47,6 +48,17 @@ function image_gd_settings() { } /** + * Validate the submitted GD settings. + */ +function image_gd_settings_validate($form, &$form_state) { + // Validate image quality range. + $value = $form_state['values']['image_jpeg_quality']; + if (!is_numeric($value) || $value < 0 || $value > 100) { + form_set_error('image_jpeg_quality', t('JPEG quality must be a number between 0 and 100.')); + } +} + +/** * Verify GD2 settings (that the right version is actually installed). * * @return |