image_rotate_dimensions
function image_rotate_dimensions
image_rotate_dimensions(array &$dimensions, array $data)
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.
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; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!image!image.effects.inc/function/image_rotate_dimensions/7.x