You are here

function image_imagick_polaroid in Imagick 7

Creates a polaroid image

Parameters

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

$angle: The angle of the polaroid effect.

Return value

TRUE or FALSE, based on success.

File

effects/imagick.polaroid.inc, line 13

Code

function image_imagick_polaroid(stdClass $image, $angle) {
  $res = $image->resource;
  if (empty($angle)) {
    $angle = mt_rand(-30, 30);
  }
  $res
    ->polaroidImage(new ImagickDraw(), $angle);

  // 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;
}