function canvasactions_file2canvas_effect in ImageCache Actions 7
Same name and namespace in other branches
- 8 canvasactions/canvasactions.inc \canvasactions_file2canvas_effect()
Image effect callback for the overlay (watermark) image effect.
Parameters
stdClass $image:
array $data:
Return value
boolean true on success, false otherwise.
1 string reference to 'canvasactions_file2canvas_effect'
- imagecache_canvasactions_image_effect_info in canvasactions/
imagecache_canvasactions.module - Implements hook_image_effect_info().
File
- canvasactions/
canvasactions.inc, line 729
Code
function canvasactions_file2canvas_effect(stdClass $image, array $data) {
$overlay = imagecache_actions_image_load($data['path']);
if ($overlay) {
if (!empty($data['scale']) && $data['scale'] > 0) {
// Scale the overlay with respect to the dimensions of the source being
// overlaid. To maintain the aspect ratio, only the width of the overlay
// is scaled like that, the height of the overlay follows the aspect
// ratio (that is why we use image_scale instead of image_resize).
$overlay_w = $image->info['width'] * $data['scale'] / 100;
image_scale($overlay, $overlay_w, NULL, TRUE);
}
if (!isset($data['alpha'])) {
$data['alpha'] = 100;
}
return image_overlay($image, $overlay, $data['xpos'], $data['ypos'], $data['alpha']);
}
return FALSE;
}