-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
[Feature] Client Side MediaMedia processing in the browser with WASMMedia processing in the browser with WASM[Feature] MediaAnything that impacts the experience of managing mediaAnything that impacts the experience of managing media[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
Description
HEIC (HEIF with HEVC codec) images are the default photo format on iPhones but are not universally supported by web servers or browsers. Currently, if the server lacks HEIC support (no ImageMagick HEVC module), uploads may fail entirely because wp_prevent_unsupported_mime_type_uploads blocks them.
Proposed Solution
Implement a server-first, canvas-fallback strategy:
- Upload HEIC to server, letting it try to process
- Sideload the original HEIC to the attachment as
image_size: 'original'— the sideload response returnsmissing_image_sizesso we know what sub-sizes need to be generated - If there are missing sizes, use browser-native
createImageBitmap()+OffscreenCanvasto decode the HEIC and convert to JPEG - Sideload the JPEG as the
scaledversion (web-friendly main image) - Use the JPEG with the existing vips resize pipeline for sub-size generation
- Sideload each sub-size back to the attachment
This leverages browser-licensed HEVC decoding (Safari everywhere, Chrome on macOS, Chrome on Windows with codec) without shipping our own HEVC decoder, avoiding patent/licensing concerns.
Scenarios
| Server HEIC support | Browser HEIC support | Result |
|---|---|---|
| Yes | Any | Server handles everything |
| No | Yes | Canvas fallback generates JPEG + sub-sizes |
| No | No | Error shown to user |
Implementation
PR: #76731
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Feature] Client Side MediaMedia processing in the browser with WASMMedia processing in the browser with WASM[Feature] MediaAnything that impacts the experience of managing mediaAnything that impacts the experience of managing media[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Type
Fields
Give feedbackNo fields configured for issues without a type.