1 image.effects.inc image_rotate_dimensions(array &$dimensions, array $data)

Image dimensions callback; Rotate.


$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.


core/modules/image/image.effects.inc, line 303
Functions needed to execute image effects provided by Image module.


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;