Skip to content

Asset dimensions doesn't respect exif rotation #14681

Description

@FrittenKeeZ

Bug description

As the title says, I expect dimensions (wdith/height) for assets to be reported taking their orientation into account.
For an image with exit orientation 6 or 8, the width and height must essentially be flipped.
This is causing automatic aspec ratio to be incorrectly detected.

How to reproduce

Giving this image exif data, the width and height should be returned as 3024x4032 respectively, but currently it's reported as 4032x3024.

array:62 [▼
"FileName" => "img_3141.jpg"
"FileDateTime" => 1779026953
"FileSize" => 4864894
"FileType" => 2
"MimeType" => "image/jpeg"
"SectionsFound" => "ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS"
"COMPUTED" => array:8 [▶]
"Make" => "Apple"
"Model" => "iPhone SE"
"Orientation" => 6
"XResolution" => "72/1"
"YResolution" => "72/1"
"ResolutionUnit" => 2
"Software" => "11.3.1"
"DateTime" => "2018:06:16 13:12:32"
"YCbCrPositioning" => 1
"Exif_IFD_Pointer" => 206
"GPS_IFD_Pointer" => 1686
"THUMBNAIL" => array:6 [▶]
"ExposureTime" => "1/610"
"FNumber" => "11/5"
"ExposureProgram" => 2
"ISOSpeedRatings" => 25
"ExifVersion" => "0221"
"DateTimeOriginal" => "2018:06:16 13:12:32"
"DateTimeDigitized" => "2018:06:16 13:12:32"
"ComponentsConfiguration" => "\x01\x02\x03\x00"
"ShutterSpeedValue" => "7791/842"
"ApertureValue" => "7983/3509"
"BrightnessValue" => "10327/1191"
"ExposureBiasValue" => "0/1"
"MeteringMode" => 5
"Flash" => 16
"FocalLength" => "83/20"
"SubjectLocation" => array:4 [▶]
"MakerNote" => "Apple iOS"
"SubSecTimeOriginal" => "604"
"SubSecTimeDigitized" => "604"
"FlashPixVersion" => "0100"
"ColorSpace" => 1
"ExifImageWidth" => 4032
"ExifImageLength" => 3024
"SensingMethod" => 2
"SceneType" => "\x01"
"ExposureMode" => 0
"WhiteBalance" => 0
"FocalLengthIn35mmFilm" => 29
"SceneCaptureType" => 0
"UndefinedTag:0xA432" => array:4 [▶]
"UndefinedTag:0xA433" => "Apple"
"UndefinedTag:0xA434" => "iPhone SE back camera 4.15mm f/2.2"
"GPSLatitudeRef" => "N"
"GPSLatitude" => array:3 [▶]
"GPSLongitudeRef" => "E"
"GPSLongitude" => array:3 [▶]
"GPSAltitudeRef" => "\x00"
"GPSAltitude" => "55623/2393"
"GPSTimeStamp" => array:3 [▶]
"GPSSpeedRef" => "K"
"GPSSpeed" => "0/1"
"GPSDateStamp" => "2018:06:16"
"UndefinedTag:0x001F" => "10/1"
]

Logs

Environment

EnvironmentLaravel Version: 13.6.0PHP Version: 8.4.3Composer Version: 2.9.2Environment: localDebug Mode: ENABLEDMaintenance Mode: OFFTimezone: UTCLocale: enCacheConfig: NOT CACHEDEvents: NOT CACHEDRoutes: NOT CACHEDViews: CACHEDDriversBroadcasting: logCache: fileDatabase: sqliteLogs: stack / dailyMail: logQueue: syncSession: fileStoragepublic/storage: NOT LINKEDStatamicAddons: 0Sites: 2 (Danish, English)Stache Watcher: Enabled (auto)Static Caching: DisabledVersion: 6.14.0 PRO

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions