Skip to content

Asset dimensions doesn't respect exif rotation #14681

@FrittenKeeZ

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

Environment
Laravel Version: 13.6.0
PHP Version: 8.4.3
Composer Version: 2.9.2
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / daily
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 0
Sites: 2 (Danish, English)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions