function canvasactions_file2canvas_image in ImageCache Actions 6.2
Same name and namespace in other branches
- 5.3 canvasactions.inc \canvasactions_file2canvas_image()
- 5.2 canvasactions.inc \canvasactions_file2canvas_image()
- 6 canvasactions.inc \canvasactions_file2canvas_image()
Place the source image on the current background
Implementation of hook_image()
Parameters
$image:
$action:
File
- canvasactions/
canvasactions.inc, line 622
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;
// Warn, but continue anyway
return TRUE;
}
if (!isset($action['alpha'])) {
$action['alpha'] = 100;
}
return imageapi_image_overlay($image, $overlay, $action['xpos'], $action['ypos'], $action['alpha']);
}