You are here

function coloractions_convert_form in ImageCache Actions 8

Same name and namespace in other branches
  1. 7 coloractions/imagecache_coloractions.module \coloractions_convert_form()

Image effect form callback for the convert image format effect.

Parameters

array $data: The current configuration for this image effect.

Return value

array The form definition for this effect.

1 string reference to 'coloractions_convert_form'
imagecache_coloractions_image_effect_info in coloractions/imagecache_coloractions.module
Implements hook_image_effect_info().

File

coloractions/imagecache_coloractions.module, line 570

Code

function coloractions_convert_form(array $data) {
  $defaults = array(
    'format' => 'image/png',
    'quality' => '75',
  );
  $data = array_merge($defaults, $data);
  $form = array(
    'help' => array(
      '#markup' => t("If you've been using transparencies in the process, the result may get saved as a PNG (as the image was treated as a one in in-between processes). If this is not desired (file sizes may get too big) you should use this process to force a flatten action before saving. "),
    ),
    'help2' => array(
      '#markup' => t("For technical reasons, changing the file format within imagecache does <em>not</em> change the filename suffix. A png may be saved as a *.jpg or vice versa. This may confuse some browsers and image software, but most of them have no trouble. "),
    ),
    'format' => array(
      '#title' => t("File format"),
      '#type' => 'select',
      '#default_value' => isset($data['format']) ? $data['format'] : 'image/png',
      '#options' => coloractions_file_formats(),
    ),
    'quality' => array(
      '#type' => 'textfield',
      '#title' => t('Quality'),
      '#description' => t('Override the default image quality. Works for Imagemagick only. Ranges from 0 to 100. For jpg, higher values mean better image quality but bigger files. For png it is a combination of compression and filter'),
      '#size' => 10,
      '#maxlength' => 3,
      '#default_value' => $data['quality'],
      '#field_suffix' => '%',
    ),
  );
  return $form;
}