Skip to content

Fix GH-20863: read HEIC/HEIF dimensions for grid and Exif-only images#135

Closed
iliaal wants to merge 1 commit into
masterfrom
fix/gh-20863-heif-exif-dimensions
Closed

Fix GH-20863: read HEIC/HEIF dimensions for grid and Exif-only images#135
iliaal wants to merge 1 commit into
masterfrom
fix/gh-20863-heif-exif-dimensions

Conversation

@iliaal

@iliaal iliaal commented Jun 27, 2026

Copy link
Copy Markdown
Owner

getimagesize() returns false for most camera-produced HEIC files. They are grid images whose primary item carries the full-size ispe, but libavifinfo drops that association once the tile items fill its 32-entry ipma table, so the dimensions never resolve. This reserves a few ipma slots for the primary item so its association survives. Some HEIC files also expose no bit-depth property, so libavifinfo declines to report even with a valid ispe; for those the dimensions come from the embedded Exif item (ImageWidth/ImageLength, or PixelXDimension/PixelYDimension in the Exif sub-IFD). The avifinfo.c change touches vendored upstream code and should also go upstream.

Fixes php#20863

Camera HEIC files are grid images whose primary item holds the full-size
ispe, but libavifinfo dropped that association once tile items filled its
32-entry ipma table, so the dimensions never resolved. Reserve ipma slots
for the primary item so its association survives. Some files also omit any
bit-depth property, so libavifinfo reports nothing even with a valid ispe;
for those, fall back to the dimensions in the embedded Exif item.

Fixes phpGH-20863
@iliaal

iliaal commented Jun 27, 2026

Copy link
Copy Markdown
Owner Author

Promoted upstream as php#22491.

@iliaal iliaal closed this Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to use getimagesize on HEIC/HEIF images

1 participant