You are here

function canvasactions_canvas2file_image in ImageCache Actions 5.3

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

Place the source image on the current background

Implementation of hook_image()

Parameters

$image:

$action:

File

./canvasactions.inc, line 258

Code

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

  // search for full (siteroot) paths, then file dir paths, then relative to the current theme
  if (file_exists($action['path'])) {
    $underlay = imageapi_image_open($action['path']);
  }
  else {
    if (file_exists(file_create_path($action['path']))) {
      $underlay = imageapi_image_open(file_create_path($action['path']));
    }
  }

  // This func modifies the underlay image by ref, placing the current canvas on it
  if (imageapi_image_overlay($underlay, $image, $action['xpos'], $action['ypos'], $action['alpha'])) {
    $image->resource = $underlay->resource;

    //$image = $underlay;
    return TRUE;
  }
}