function image_rotate

Rotates an image by the given number of degrees.

Parameters

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

int $degrees: The number of (clockwise) degrees to rotate the image.

string $background: (optional) An hexadecimal integer specifying the background color to use for the uncovered area of the image after the rotation. E.g. 0x000000 for black, 0xff00ff for magenta, and 0xffffff for white. For images that support transparency, this will default to transparent. Otherwise it will be white.

Return value

bool TRUE on success, FALSE on failure.

See also

image_load()

\Drupal\system\Plugin\ImageToolkitInterface::rotate()

Related topics

2 calls to image_rotate()
image_rotate_effect in drupal/core/modules/image/image.effects.inc
Image effect callback; Rotate an image resource.
ToolkitTest::testRotate in drupal/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php
Test the image_rotate() function.
2 string references to 'image_rotate'
ImageDimensionsTest::testImageDimensions in drupal/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php
Test styled image dimensions cumulatively.
ImageUpgradePathTest::testImageStyleUpgrade in drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/ImageUpgradePathTest.php
Tests that custom and overridden image styles have been upgraded.

File

drupal/core/includes/image.inc, line 241
API for manipulating images.

Code

function image_rotate($image, $degrees, $background = NULL) {
  return $image->toolkit
    ->rotate($image, $degrees, $background);
}