fix: apply EXIF orientation before resizing portrait images

Smartphone photos stored in landscape orientation with an EXIF rotation
tag were being saved to S3 in the wrong orientation. Image.php read the
raw pixel dimensions without first applying the EXIF tag, so portrait
photos (e.g. 4032×3024 with Orientation=6) were classified and resized
as landscape (1920×1080).

Calling orient() immediately after read() physically rotates the image
to match its EXIF orientation tag before any dimension checks or
scaling. This ensures portrait photos remain portrait after processing.

Intervention Image v3 reference:
https://image.intervention.io/v3/modifying/orientation
pull/6618/head
Stefan 2 months ago
parent f0ac4aa82e
commit 4f13ebfe3f

@ -203,6 +203,7 @@ class Image
}
$img = $this->imageManager->read($fileContents);
$img = $img->orient();
$ratio = $this->getAspect($img->width(), $img->height(), $thumbnail);
$aspect = $ratio['dimensions'];

Loading…
Cancel
Save