WP_Image_Editor_Imagick::flip()publicWP 3.5.0

Flips current image.

Method of the class: WP_Image_Editor_Imagick{}

No Hooks.

Return

true|WP_Error.

Usage

$WP_Image_Editor_Imagick = new WP_Image_Editor_Imagick();
$WP_Image_Editor_Imagick->flip( $horz, $vert );
$horz(true|false) (required)
Flip along Horizontal Axis
$vert(true|false) (required)
Flip along Vertical Axis

Changelog

Since 3.5.0 Introduced.

WP_Image_Editor_Imagick::flip() code WP 6.5.2

public function flip( $horz, $vert ) {
	try {
		if ( $horz ) {
			$this->image->flipImage();
		}

		if ( $vert ) {
			$this->image->flopImage();
		}

		// Normalize EXIF orientation data so that display is consistent across devices.
		if ( is_callable( array( $this->image, 'setImageOrientation' ) ) && defined( 'Imagick::ORIENTATION_TOPLEFT' ) ) {
			$this->image->setImageOrientation( Imagick::ORIENTATION_TOPLEFT );
		}
	} catch ( Exception $e ) {
		return new WP_Error( 'image_flip_error', $e->getMessage() );
	}

	return true;
}