You are here

function canvasactions_file2canvas_form in ImageCache Actions 6.2

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

Place a given image on top of the current canvas

Implementation of imagecache_hook_form()

Parameters

$action array of settings for this action:

Return value

a form definition

File

canvasactions/canvasactions.inc, line 558

Code

function canvasactions_file2canvas_form($action) {
  if (imageapi_default_toolkit() != 'imageapi_gd') {
    drupal_set_message('Overlays are not currently supported by using imagemagick. This effect requires GD image toolkit only.', 'warning');
  }
  $defaults = array(
    'xpos' => '',
    'ypos' => '',
    'alpha' => '100',
    'path' => '',
  );
  $action = array_merge($defaults, (array) $action);
  $form = array(
    'help' => array(
      '#type' => 'markup',
      '#value' => t('Note that using a transparent overlay that is larger than the source image may result in unwanted results - a solid background.'),
    ),
  );
  $form += imagecache_actions_pos_form($action);
  $form['alpha'] = array(
    '#type' => 'textfield',
    '#title' => t('opacity'),
    '#default_value' => $action['alpha'],
    '#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.'),
  );
  $form['path'] = array(
    '#type' => 'textfield',
    '#title' => t('file name'),
    '#default_value' => $action['path'],
    '#description' => t('File may be in the "files/" folder, or relative to the Drupal siteroot.'),
    '#element_validate' => array(
      'canvasactions_file2canvas_validate_file',
    ),
  );
  return $form;
}