You are here

function _imagemagick_build_version in ImageMagick 7

#after_build callback to output ImageMagick version or any errors in image toolkit settings form.

1 string reference to '_imagemagick_build_version'
image_imagemagick_settings in ./imagemagick.module
Retrieve settings for the ImageMagick toolkit.

File

./imagemagick.module, line 109
Provides ImageMagick integration.

Code

function _imagemagick_build_version($element, &$form_state) {

  // Do not attempt to output version information when the form is submitted.
  // @see imagemagick_element_validate_path()
  if ($form_state['process_input']) {
    return $element;
  }

  // When the form is not submitted and only rendered, attempt to output version
  // information.
  $status = _imagemagick_check_path($form_state['values']['imagemagick_convert']);
  if ($status['errors']) {
    $element['version'] = array(
      '#markup' => '<p class="error">' . implode('<br />', $status['errors']) . '</p>',
    );
  }
  else {
    $element['version'] = array(
      '#type' => 'item',
      '#title' => t('Version information'),
      '#markup' => '<pre>' . check_plain(trim($status['output'])) . '</pre>',
      '#description' => t('ImageMagick was found and returns this version information.'),
    );
  }
  return $element;
}