From 72fcf970c33290bd058e66eaca0fb88b564cdf05 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Fri, 21 Mar 2025 01:44:50 +0100 Subject: [PATCH] Exif.php: add exifOrientationOnSide --- inc/Data/Exif.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/inc/Data/Exif.php b/inc/Data/Exif.php index 77b1011c..caf9bb82 100644 --- a/inc/Data/Exif.php +++ b/inc/Data/Exif.php @@ -11,4 +11,14 @@ class Exif { public const EXIF_ORIENTATION_270_UPRIGHT = 7; public const EXIF_ORIENTATION_270_FLIPPED = 8; public const EXIF_ORIENTATION_UNDEFINED = 9; + + /** + * Should you switch width and height since the image is on the side? + * + * @param int $exif_orientation An EXIF_ORIENTATION_* constant. + * @return boolean + */ + public static function exifOrientationOnSide(int $exif_orientation): bool { + return $exif_orientation >= 5 && $exif_orientation <= 8; + } }