You are here

function canvasactions_file2canvas_image in ImageCache Actions 6

Same name and namespace in other branches
  1. 5.3 canvasactions.inc \canvasactions_file2canvas_image()
  2. 5.2 canvasactions.inc \canvasactions_file2canvas_image()
  3. 6.2 canvasactions/canvasactions.inc \canvasactions_file2canvas_image()

Place the source image on the current background

Implementation of hook_image()

Parameters

$image:

$action:

File

./canvasactions.inc, line 531
Helper functions for the text2canvas action for imagecache

Code

function canvasactions_file2canvas_image(&$image, $action = array()) {

  // search for full (siteroot) paths, then file dir paths, then relative to the current theme
  if (file_exists($action['path'])) {
    $overlay = imageapi_image_open($action['path'], $image->toolkit);
  }
  else {
    if (file_exists(file_create_path($action['path']))) {
      $overlay = imageapi_image_open(file_create_path($action['path']), $image->toolkit);
    }
  }
  if (!isset($overlay) || !$overlay) {
    trigger_error(t("Failed to find overlay image %path for imagecache_actions file-to-canvas action. File was not found in the sites 'files' path or the current theme folder.", array(
      '%path' => $action['path'],
    )), E_USER_WARNING);
    return FALSE;
  }
  return imageapi_image_overlay($image, $overlay, $action['xpos'], $action['ypos'], $action['alpha']);
}