You are here

function imagick_annotate_form in Imagick 7

Settings form for the imagick annotate effect.

Parameters

$action: The saved action form parameters.

1 string reference to 'imagick_annotate_form'
imagick_image_effect_info in ./imagick.module
Implements hook_image_effect_info()

File

effects/imagick.annotate.inc, line 89

Code

function imagick_annotate_form($data) {
  $data = array_merge(imagick_annotate_defaults(), (array) $data);

  // Get fonts
  $imagick = new Imagick();
  $available_fonts = $imagick
    ->queryFonts();
  $form['text_fieldset'] = array(
    '#type' => 'fieldset',
    '#collapsible' => FALSE,
    '#title' => t('Text'),
    'text' => array(
      '#type' => 'textfield',
      '#title' => t('Text'),
      '#description' => t('Text to annotate the image with.'),
      '#default_value' => $data['text_fieldset']['text'],
    ),
    'font' => array(
      '#type' => 'select',
      '#options' => array_combine($available_fonts, $available_fonts),
      '#title' => t('Font'),
      '#description' => t('Fonts that ImageMagick knows about.'),
      '#default_value' => $data['text_fieldset']['font'],
    ),
    'size' => array(
      '#type' => 'textfield',
      '#title' => t('Font size'),
      '#default_value' => $data['text_fieldset']['size'],
      '#size' => 3,
    ),
    'HEX' => array(
      '#type' => 'textfield',
      '#title' => t('Color'),
      '#default_value' => $data['text_fieldset']['HEX'],
      '#size' => 7,
      '#colorpicker' => TRUE,
    ),
  );
  $form['position_fieldset'] = array(
    '#type' => 'fieldset',
    '#collapsible' => FALSE,
    '#title' => t('Position'),
    'anchor' => array(
      '#type' => 'radios',
      '#title' => t('Anchor'),
      '#options' => array(
        'left-top' => t('Top left'),
        'center-top' => t('Top center'),
        'right-top' => t('Top right'),
        'left-center' => t('Center left'),
        'center-center' => t('Center'),
        'right-center' => t('Center right'),
        'left-bottom' => t('Bottom left'),
        'center-bottom' => t('Bottom center'),
        'right-bottom' => t('Bottom right'),
      ),
      '#theme' => 'image_anchor',
      '#default_value' => $data['position_fieldset']['anchor'],
    ),
    'padding_x' => array(
      '#type' => 'textfield',
      '#title' => t('Padding X'),
      '#default_value' => $data['position_fieldset']['padding_x'],
      '#description' => t('Enter a value in pixels or percent'),
      '#size' => 3,
    ),
    'padding_y' => array(
      '#type' => 'textfield',
      '#title' => t('Padding Y'),
      '#default_value' => $data['position_fieldset']['padding_y'],
      '#description' => t('Enter a value in pixels or percent'),
      '#size' => 3,
    ),
  );
  return $form;
}