_rotate_image_resource

Returns an image resource.

Description

(resource|false) _rotate_image_resource( (resource) $img, (float|int) $angle ); 

Internal use only.

Returns (resource|false)

GD image resource, false otherwise.

Parameters (2)

0. $img (resource)
Image resource.
1. $angle (float|int)
Image rotation angle, in degrees.

Usage

  1. if ( !function_exists( '_rotate_image_resource' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/image-edit.php'; 
  3.  
  4. // Image resource. 
  5. $img = null; 
  6.  
  7. // Image rotation angle, in degrees. 
  8. $angle = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = _rotate_image_resource($img, $angle); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/image-edit.php  
  1. function _rotate_image_resource($img, $angle) { 
  2. _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::rotate()' ); 
  3. if ( function_exists('imagerotate') ) { 
  4. $rotated = imagerotate($img, $angle, 0); 
  5. if ( is_resource($rotated) ) { 
  6. imagedestroy($img); 
  7. $img = $rotated; 
  8. return $img;