You are here

function image_imagick_overlay in Imagick 7

Adds an overlay to a image

Parameters

$image: An image object. The $image->resource value will be modified by this call.

$layer: The image that needs to be placed on top of the source image.

$x: The horizontal offset of the overlay.

$y: The vertical offset of the overlay.

$alpha: The transparency of the overlay layer.

File

effects/imagick.coloroverlay.inc, line 17

Code

function image_imagick_overlay(stdClass $image, stdClass $layer, $x, $y, $alpha = 100, $reverse = FALSE) {
  $path = drupal_realpath($layer->source);
  $overlay = new Imagick($path);
  if ($alpha != 100) {
    $overlay
      ->setImageFormat('png');
    imagick_coloroverlay_set_opacity($overlay, $alpha);
  }
  return $image->resource
    ->compositeImage($overlay, Imagick::COMPOSITE_DEFAULT, $x, $y);
}