You are here

function imagick_rotate in Imagick 7

Image effect callback; Rotate an image resource.

Parameters

$image: An image object returned by image_load().

$data: An array of attributes to use when performing the rotate effect containing the following items:

  • "degrees": The number of (clockwise) degrees to rotate the image.
  • "random": A boolean indicating that a random rotation angle should be used for this image. The angle specified in "degrees" is used as a positive and negative maximum.
  • "bgcolor": The background color to use for exposed areas of the image. Use web-style hex colors (#FFFFFF for white, #000000 for black). Leave blank for transparency on image types that support it.

Return value

TRUE on success. FALSE on failure to rotate image.

See also

image_rotate().

2 string references to 'imagick_rotate'
imagick_image_effect_info in ./imagick.module
Implements hook_image_effect_info()
_imagick_alter_existing_effect_names in ./imagick.install
Helper function to alter existing effect names

File

effects/imagick.rotate.inc, line 66

Code

function imagick_rotate(&$image, $data) {
  if (!empty($data['random'])) {
    $degrees = $data['degrees'];
    $data['degrees'] = $angle = mt_rand(-$degrees, $degrees);
  }
  image_toolkit_invoke('rotate', $image, $data);
}