You are here

function canvasactions_file2canvas_form in ImageCache Actions 8

Same name and namespace in other branches
  1. 5.3 canvasactions.inc \canvasactions_file2canvas_form()
  2. 5.2 canvasactions.inc \canvasactions_file2canvas_form()
  3. 6.2 canvasactions/canvasactions.inc \canvasactions_file2canvas_form()
  4. 6 canvasactions.inc \canvasactions_file2canvas_form()
  5. 7 canvasactions/canvasactions.inc \canvasactions_file2canvas_form()

Image effect form callback for the overlay (watermark) effect.

Parameters

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

Return value

array The form definition for this effect.

2 string references to 'canvasactions_file2canvas_form'
imagecache_canvasactions_image_effect_info in canvasactions/imagecache_canvasactions.module
Implements hook_image_effect_info().
image_effects_text_test_image_default_styles in image_effects_text/image_effects_text_test/image_effects_text_test.module
Implements hook_image_default_styles().

File

canvasactions/canvasactions.inc, line 657

Code

function canvasactions_file2canvas_form(array $data) {
  $defaults = array(
    'xpos' => '',
    'ypos' => '',
    'alpha' => '100',
    'scale' => '',
    'path' => '',
  );
  $data = array_merge($defaults, (array) $data);
  $form = array(
    'help' => array(
      '#markup' => t('Note that using a non transparent overlay that is larger than the source image may result in unwanted results - a solid background.'),
    ),
  );
  $form += imagecache_actions_pos_form($data);
  $form['alpha'] = array(
    '#type' => 'textfield',
    '#title' => t('opacity'),
    '#default_value' => $data['alpha'],
    '#field_suffix' => t('%'),
    '#size' => 6,
    '#description' => t('Opacity: 0-100. <b>Warning:</b> Due to a limitation in the GD toolkit, using an opacity other than 100% requires the system to use an algorithm that\'s much slower than the built-in functions. If you want partial transparency, you are better to use an already-transparent png as the overlay source image.'),
    '#element_validate' => array(
      'imagecache_actions_validate_number_non_negative',
    ),
  );
  $form['scale'] = array(
    '#type' => 'textfield',
    '#title' => t('scale'),
    '#default_value' => $data['scale'],
    '#field_suffix' => t('%'),
    '#size' => 6,
    '#description' => t('Scales the overlay with respect to the source, thus not its own dimensions. Leave empty to use the original size of overlay image.'),
    '#element_validate' => array(
      'imagecache_actions_validate_number_positive',
    ),
  );
  $form['path'] = array(
    '#type' => 'textfield',
    '#title' => t('file name'),
    '#default_value' => $data['path'],
    '#description' => imagecache_actions_file_field_description(),
    '#element_validate' => array(
      'imagecache_actions_validate_file',
    ),
  );
  return $form;
}