protected function _autoRotate($imageFile, $format) {
		$orientation = ImagineUtility::getImageOrientation($imageFile);
		$degree = 0;
		if ($orientation === false) {
			return false;
		}
		if ($orientation === 0) {
			return true;
		}
		switch ($orientation) {
			case 180:
				$degree = -180;
				break;
			case -90:
				$degree = 90;
				break;
			case 90:
				$degree = -90;
				break;
		}
		$processor = new ImageProcessor();
		$image = $processor->open($imageFile);
		$processor->rotate($image, ['degree' => $degree]);
		$image->save(['format' => $format]);

		return true;
	}
protected function _autoRotate($imageFile, $format) {
		$orientation = ImagineUtility::getImageOrientation($imageFile);
		$degree = 0;
		if ($orientation === false) {
			return false;
		}
		if ($orientation === 0) {
			return true;
		}
		switch ($orientation) {
			case 180:
				$degree = -180;
				break;
			case -90:
				$degree = 90;
				break;
			case 90:
				$degree = -90;
				break;
		}
		$processor = new ImageProcessor();
		$image = $processor->open($imageFile);
		$processor->rotate($image, ['degree' => $degree]);
		$image->save(['format' => $format]);

		return true;
	}
protected function _autoRotate ( $ imageFile , $ format ) { $ orientation = ImagineUtility :: getImageOrientation ( $ imageFile ) ; $ degree = 0 ; if ( $ orientation === false ) { return false ; } if ( $ orientation === 0 ) { return true ; } switch ( $ orientation ) { case 180 : $ degree = - 180 ; break ; case - 90 : $ degree = 90 ; break ; case 90 : $ degree = - 90 ; break ; } $ processor = new ImageProcessor ( ) ; $ image = $ processor -> open ( $ imageFile ) ; $ processor -> rotate ( $ image , [ 'degree' => $ degree ] ) ; $ image -> save ( [ 'format' => $ format ] ) ; return true ; }
Auto rotates the image if an orientation in the exif data is found that is not 0.

@param string $imageFile Path to the image file.
@param string $format Format of the image to save. Workaround for imagines save(). :(
@return boolean
Auto rotates the image if an orientation in the exif data is found that is not 0 .