_rotate_image_resource()WP 2.9.0

Deprecated from version 3.5.0. It is no longer supported and can be removed in future releases. Use WP_Image_Editor::rotate() instead.

Returns an image resource. Internal use only.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

resource|GdImage|false. GD image resource or GdImage instance, false otherwise.

Usage

_rotate_image_resource( $img, $angle );
$img(resource|GdImage) (required)
Image resource.
$angle(float|int) (required)
Image rotation angle, in degrees.

Notes

Changelog

Since 2.9.0 Introduced.
Deprecated since 3.5.0 Use WP_Image_Editor::rotate()

_rotate_image_resource() code WP 6.6.2

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_gd_image( $rotated ) ) {
			imagedestroy( $img );
			$img = $rotated;
		}
	}

	return $img;
}