imagick.polaroid.inc in Imagick 7
File
effects/imagick.polaroid.inc
View source
<?php
function image_imagick_polaroid(stdClass $image, $angle) {
$res = $image->resource;
if (empty($angle)) {
$angle = mt_rand(-30, 30);
}
$res
->polaroidImage(new ImagickDraw(), $angle);
$dimensions = $res
->getImageGeometry();
$res
->setImagePage($dimensions['width'], $dimensions['height'], 0, 0);
$image->info['width'] = $dimensions['width'];
$image->info['height'] = $dimensions['height'];
return $res;
}
function imagick_polaroid($image, $data = array()) {
image_toolkit_invoke('polaroid', $image, $data);
}
function imagick_polaroid_form($data) {
$data = array_merge(imagick_polaroid_defaults(), (array) $data);
$form['angle'] = array(
'#type' => 'textfield',
'#title' => t('angle'),
'#description' => t('The angle of the polaroid image. Leave this field empty to generate a random angle between -30 and 30 degrees.'),
'#default_value' => $data['angle'],
'#size' => 3,
);
return $form;
}
function imagick_polaroid_defaults() {
return array(
'angle' => '10',
);
}