function image_rotate_dimensions in Drupal 7
Image dimensions callback; Rotate.
Parameters
$dimensions: Dimensions to be modified - an array with components width and height, in pixels.
$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.
1 string reference to 'image_rotate_dimensions'
- image_image_effect_info in modules/
image/ image.effects.inc - Implements hook_image_effect_info().
File
- modules/
image/ image.effects.inc, line 301 - Functions needed to execute image effects provided by Image module.
Code
function image_rotate_dimensions(array &$dimensions, array $data) {
// If the rotate is not random and the angle is a multiple of 90 degrees,
// then the new dimensions can be determined.
if (!$data['random'] && (int) $data['degrees'] == $data['degrees'] && $data['degrees'] % 90 == 0) {
if ($data['degrees'] % 180 != 0) {
$temp = $dimensions['width'];
$dimensions['width'] = $dimensions['height'];
$dimensions['height'] = $temp;
}
}
else {
$dimensions['width'] = $dimensions['height'] = NULL;
}
}