You are here

function image_imagick_settings_validate in Imagick 7

Validate the submitted Imagick settings.

1 string reference to 'image_imagick_settings_validate'
image_imagick_settings in ./imagick.module
Retrieve settings for the Imagick toolkit.

File

./imagick.module, line 166
Imagick toolkit for image manipulation within Drupal.

Code

function image_imagick_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.'));
  }

  // Check if the quality value has changed
  if (variable_get('image_jpeg_quality', 80) !== $value) {

    // Flush image style images
    foreach (image_styles() as $style) {
      image_style_flush($style);
    }
  }
}