You are here

function imagemagick_advanced_form_system_image_toolkit_settings_alter in ImageMagick 7

Implements hook_form_FORMID_alter().

File

imagemagick_advanced/imagemagick_advanced.module, line 11
Provides advanced ImageMagick effects and options.

Code

function imagemagick_advanced_form_system_image_toolkit_settings_alter(&$form, &$form_state, $form_id) {
  if (image_get_toolkit() != 'imagemagick') {
    return;
  }
  $im_form =& $form['image_toolkit_settings']['imagemagick'];
  $im_form['imagemagick_advanced_density'] = array(
    '#type' => 'checkbox',
    '#title' => t('Change image resolution to 72 ppi'),
    '#default_value' => variable_get('imagemagick_advanced_density', 0),
    '#return_value' => 72,
    '#description' => t('Resamples the image <a href="@help-url">density</a> to a resolution of 72 pixels per inch, the default for web images. Does not affect the pixel size or quality.', array(
      '@help-url' => 'http://www.imagemagick.org/script/command-line-options.php#density',
    )),
  );
  $im_form['imagemagick_advanced_colorspace'] = array(
    '#type' => 'select',
    '#title' => t('Convert colorspace'),
    '#default_value' => variable_get('imagemagick_advanced_colorspace', 0),
    '#options' => array(
      'RGB' => 'RGB',
      'sRGB' => 'sRGB',
      'GRAY' => t('Gray'),
    ),
    '#empty_value' => 0,
    '#empty_option' => t('- Original -'),
    '#description' => t('Converts processed images to the specified <a href="@help-url">colorspace</a>. The color profile option overrides this setting.', array(
      '@help-url' => 'http://www.imagemagick.org/script/command-line-options.php#colorspace',
    )),
    '#states' => array(
      'enabled' => array(
        ':input[name="imagemagick_advanced_profile"]' => array(
          'value' => '',
        ),
      ),
    ),
  );
  $im_form['imagemagick_advanced_profile'] = array(
    '#type' => 'textfield',
    '#title' => t('Color profile path'),
    '#default_value' => variable_get('imagemagick_advanced_profile', ''),
    '#description' => t('The path to a <a href="@help-url">color profile</a> file that all processed images will be converted to. Leave blank to disable. Use a <a href="@color-url">sRGB profile</a> to correct the display of professional images and photography.', array(
      '@help-url' => 'http://www.imagemagick.org/script/command-line-options.php#profile',
      '@color-url' => 'http://www.color.org/profiles.html',
    )),
  );
}