You are here

function image_gd_rotate in Drupal 4

Same name and namespace in other branches
  1. 5 includes/image.inc \image_gd_rotate()
  2. 6 includes/image.gd.inc \image_gd_rotate()
  3. 7 modules/system/image.gd.inc \image_gd_rotate()

Rotate an image the given number of degrees.

File

includes/image.inc, line 252

Code

function image_gd_rotate($source, $destination, $degrees, $bg_color = 0) {
  if (!function_exists('imageRotate')) {
    return false;
  }
  $info = image_get_info($source);
  if (!$info) {
    return false;
  }
  $im = image_gd_open($source, $info['extension']);
  if (!$im) {
    return false;
  }
  $res = imageRotate($im, $degrees, $bg_color);
  $result = image_gd_close($res, $destination, $info['extension']);
  return $result;
}