#111106Read image orientation independently of ext-exif, including AVIF and HEIC
Description
Problem
Photos often store their pixels sideways and say how to turn them upright: JPEG, TIFF, PNG and WebP with an EXIF orientation, AVIF and HEIC with the irot and imir properties of their primary item.
TYPO3 reads the orientation only through exif_read_data(), i.e. only where ext-exif is loaded, and ext-exif reads JPEG and TIFF alone. As a result:
- the width and height in
sys_file_metadataare those of the sideways raster for PNG, WebP, AVIF and HEIC always, and for JPEG and TIFF without ext-exif, while ImageMagick renders these images upright, so aspect ratios are wrong in the cropping wizard and in renderedwidth/@height@ attributes - GIFBUILDER, which draws with GD, places unscaled images sideways, since GD applies no orientation. The AVIF decoder of GD ignores
irot/@imir@ as well.
Solution
- An
ImageOrientationReaderreads the EXIF orientation of JPEG, TIFF, PNG and WebP, through ext-exif where it is loaded for JPEG and TIFF, by itself otherwise. - Of AVIF and HEIC it reads
irot/@imir@ of the primary item and expresses them as the equivalent EXIF orientation. All eight orientations are cross-checked against ImageMagick, which applies them through libheif. ImageInforeports the upright size,GraphicsCanvas(GIFBUILDER) turns images upright.- An upgrade wizard corrects the dimensions of images indexed before
Reviews 1
History 09
-
Gerrit Code Review pushed patch set 1 for main to change 96776 status
NewUnder Review <span data-processor="relativetime" data-value="2026-10-17T08:43:38+00:00" > 10/17/26, 08:43 </span> -
Gerrit Code Review pushed patch set 2 for main to change 96776 <span data-processor="relativetime" data-value="2026-10-17T11:55:07+00:00" > 10/17/26, 11:55 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 96776 <span data-processor="relativetime" data-value="2026-10-19T14:51:55+00:00" > 10/19/26, 14:51 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 96776 <span data-processor="relativetime" data-value="2026-10-20T21:10:55+00:00" > 10/20/26, 21:10 </span>
-
Gerrit Code Review pushed patch set 5 for main to change 96776 <span data-processor="relativetime" data-value="2026-10-20T21:59:09+00:00" > 10/20/26, 21:59 </span>
-
Gerrit Code Review pushed patch set 6 for main to change 96776 <span data-processor="relativetime" data-value="2026-10-21T12:05:50+00:00" > 10/21/26, 12:05 </span>
-
Gerrit Code Review pushed patch set 7 for main to change 96776 <span data-processor="relativetime" data-value="2026-10-21T17:33:55+00:00" > 10/21/26, 17:33 </span>
-
Gerrit Code Review pushed patch set 8 for main to change 96776 <span data-processor="relativetime" data-value="2026-10-22T18:42:35+00:00" > 10/22/26, 18:42 </span>
-
Gerrit Code Review pushed patch set 9 for main to change 96776 <span data-processor="relativetime" data-value="2026-11-09T00:31:14+00:00" > 11/09/26, 00:31 </span>