You are here

function image_imagick_frame in Imagick 7

Adds a frame to an image

Parameters

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

$matte_color: The string representing the matte color

$width: The width of the border

$height: The height of the border

$inner_bevel: The inner bevel width

$outer_bevel: The outer bevel width

Return value

TRUE or FALSE, based on success.

File

effects/imagick.frame.inc, line 21

Code

function image_imagick_frame(stdClass $image, $matte_color, $width, $height, $inner_bevel, $outer_bevel) {
  $res = $image->resource;
  $color = empty($matte_color) ? 'none' : $matte_color;
  $res
    ->frameImage(new ImagickPixel($color), $width, $height, $inner_bevel, $outer_bevel);

  // Reset image dimensions
  $dimensions = $res
    ->getImageGeometry();
  $res
    ->setImagePage($dimensions['width'], $dimensions['height'], 0, 0);
  $image->info['width'] = $dimensions['width'];
  $image->info['height'] = $dimensions['height'];
  return $res;
}