You are here

function _imageapi_imagemagick_build_version in ImageAPI 5

Same name and namespace in other branches
  1. 6 imageapi_imagemagick.module \_imageapi_imagemagick_build_version()
1 string reference to '_imageapi_imagemagick_build_version'
imageapi_imagemagick_settings_form in ./imageapi_imagemagick.module
Settings form for the toolkit.

File

./imageapi_imagemagick.module, line 61
ImageMagick toolkit functions

Code

function _imageapi_imagemagick_build_version($form_element, $form_values) {

  // make sure path is set and valid before running after build.
  if ($path_errors = _imageapi_imagemagick_check_path($form_values['imageapi_imagemagick_convert'])) {

    // check here is primarily for pre-existing bad settings...
    // the #validate should prevent users from adding bad paths.
    $form_element['imageapi_imagemagick_binary'] = array(
      '#value' => '<p class="error">' . implode('<br />', $path_errors) . '</p>',
    );
  }
  else {
    _imageapi_imagemagick_convert_exec('-version', $output, $errors);
    $form_element['imageapi_imagemagick_binary']['version'] = array(
      '#title' => t('Version information'),
      '#value' => '<pre>' . check_plain(trim($output)) . '</pre>',
      '#description' => t('The ImageMagick <kbd>convert</kbd> binary was located and return this version information.'),
    );
  }
  $form_element['imageapi_imagemagick_binary']['version']['#type'] = 'item';
  $form_element['imageapi_imagemagick_binary']['version']['#weight'] = -1;
  return $form_element;
}