W3cubDocs

/WordPress

WP_Image_Editor_Imagick::maybe_exif_rotate()

Check if a JPEG image has EXIF Orientation tag and rotate it if needed.

Description

As ImageMagick copies the EXIF data to the flipped/rotated image, proceed only if EXIF Orientation can be reset afterwards.

Return

(bool|WP_Error) True if the image was rotated. False if no EXIF data or if the image doesn't need rotation. WP_Error if error while rotating.

Source

File: wp-includes/class-wp-image-editor-imagick.php

public function maybe_exif_rotate() {
		if ( is_callable( array( $this->image, 'setImageOrientation' ) ) && defined( 'Imagick::ORIENTATION_TOPLEFT' ) ) {
			return parent::maybe_exif_rotate();
		} else {
			return new WP_Error( 'write_exif_error', __( 'The image cannot be rotated because the embedded meta data cannot be updated.' ) );
		}
	}

Changelog

Version Description
5.3.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_image_editor_imagick/maybe_exif_rotate