Index: imageapi_imagemagick.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi_imagemagick.module,v retrieving revision 1.25 diff -u -p -r1.25 imageapi_imagemagick.module --- imageapi_imagemagick.module 17 Oct 2010 18:03:13 -0000 1.25 +++ imageapi_imagemagick.module 11 Dec 2010 16:32:38 -0000 @@ -35,7 +35,7 @@ function image_imageapi_imagemagick_sett $form['imageapi_imagemagick_binary'] = array( '#type' => 'fieldset', - '#title' => t('ImageMagick Binary'), + '#title' => t('ImageMagick Binaries'), '#collapsible' => FALSE, '#description' => t('ImageMagick is a standalone program used to manipulate images. To use it, it must be installed on your server and you need to know where it is located. If you are unsure of the exact path consult your ISP or server administrator.'), ); @@ -46,6 +46,16 @@ function image_imageapi_imagemagick_sett '#required' => TRUE, '#description' => t('Specify the complete path to the ImageMagic convert binary. For example: /usr/bin/convert or C:\Program Files\ImageMagick-6.3.4-Q16\convert.exe'), '#element_validate' => array('imageapi_imagemagick_validate_path'), + '#weight' => 1, + ); + $form['imageapi_imagemagick_binary']['imageapi_imagemagick_identify'] = array( + '#type' => 'textfield', + '#title' => t('Path to the "identify" binary'), + '#default_value' => variable_get('imageapi_imagemagick_identify', '/usr/bin/identify'), + '#required' => TRUE, + '#description' => t('Specify the complete path to the ImageMagic identify binary. For example: /usr/bin/identify or C:\Program Files\ImageMagick-6.3.4-Q16\identify.exe'), + '#element_validate' => array('imageapi_imagemagick_validate_path'), + '#weight' => 3, ); $form['imageapi_imagemagick_binary']['imageapi_imagemagick_debugging'] = array( '#type' => 'checkbox', @@ -54,7 +64,8 @@ function image_imageapi_imagemagick_sett '#description' => t('Checking this option will display the ImageMagick commands and output to users with the administer site configuration permission.'), '#weight' => 2, ); - $form['imageapi_imagemagick_binary']['version'] = array('#weight' => -1); + $form['imageapi_imagemagick_binary']['version_convert'] = array('#weight' => 2); + $form['imageapi_imagemagick_binary']['version_identify'] = array('#weight' => 4); $form['imageapi_imagemagick_binary']['#after_build'] = array('_imageapi_imagemagick_build_version'); return $form; @@ -65,27 +76,46 @@ function _imageapi_imagemagick_build_ver if ($path_errors = _imageapi_imagemagick_check_path($form_state['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( + $form_element['imageapi_imagemagick_binary']['version_convert'] = array( '#markup' => '
'. implode('
', $path_errors) .'
'. check_plain(trim($output)) .'', '#description' => t('The ImageMagick convert binary was located and return this version information.'), ); } - $form_element['imageapi_imagemagick_binary']['version']['#type'] = 'item'; - $form_element['imageapi_imagemagick_binary']['version']['#weight'] = -1; + $form_element['imageapi_imagemagick_binary']['version_convert']['#type'] = 'item'; + $form_element['imageapi_imagemagick_binary']['version_convert']['#weight'] = 2; + + // make sure path is set and valid before running after build. + if ($path_errors = _imageapi_imagemagick_check_path($form_state['values']['imageapi_imagemagick_identify'])) { + // check here is primarily for pre-existing bad settings... + // the #validate should prevent users from adding bad paths. + $form_element['imageapi_imagemagick_binary']['version_identify'] = array( + '#markup' => '
'. implode('
', $path_errors) .'
'. check_plain(trim($output)) .'', + '#description' => t('The ImageMagick identify binary was located and return this version information.'), + ); + } + $form_element['imageapi_imagemagick_binary']['version_identify']['#type'] = 'item'; + $form_element['imageapi_imagemagick_binary']['version_identify']['#weight'] = 4; + return $form_element; } function imageapi_imagemagick_validate_path($element) { - if ($element['#post'] == 'imageapi_imagemagick' && $errors = _imageapi_imagemagick_check_path($element['#value'])) { + if ($errors = _imageapi_imagemagick_check_path($element['#value'])) { form_set_error($element['#parents'][0], implode('