A WordPress-centric search engine for devs and theme authors



_rotate_image_resource ›

Since2.9.0
Deprecated3.5.0
_rotate_image_resource ( $img, $angle )
Parameters: (2)
  • (resource) $img Image resource.
    Required: Yes
  • (float|int) $angle Image rotation angle, in degrees.
    Required: Yes
See:
  • WP_Image_Editor::rotate()
Returns:
  • (resource|false) GD image resource, false otherwise.
Defined at:
Codex:

Returns an image resource. Internal use only.



Source

function _rotate_image_resource( $img, $angle ) {
	_deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::rotate()' );
	if ( function_exists( 'imagerotate' ) ) {
		$rotated = imagerotate( $img, $angle, 0 );
		if ( is_resource( $rotated ) ) {
			imagedestroy( $img );
			$img = $rotated;
		}
	}
	return $img;
}