Skip to content

Media: Enable HEIC/HEIF uploads when server lacks image editor support#11323

Open
adamsilverstein wants to merge 1 commit intoWordPress:trunkfrom
adamsilverstein:add/heic-canvas-fallback
Open

Media: Enable HEIC/HEIF uploads when server lacks image editor support#11323
adamsilverstein wants to merge 1 commit intoWordPress:trunkfrom
adamsilverstein:add/heic-canvas-fallback

Conversation

@adamsilverstein
Copy link
Member

@adamsilverstein adamsilverstein commented Mar 20, 2026

Trac ticket: https://core.trac.wordpress.org/ticket/64915

What?

Allow HEIC/HEIF image uploads to succeed even when the server's image editor (ImageMagick/GD) doesn't support HEIC. Currently, wp_prevent_unsupported_mime_type_uploads blocks these uploads entirely.

Gutenberg PR: WordPress/gutenberg#76731

Why?

HEIC is the default photo format on iPhones. When users upload HEIC images and the server can't process them, the upload fails with an unhelpful error. With the client-side media processing feature, the browser can decode HEIC using its native createImageBitmap() API (leveraging OS-licensed HEVC codecs) and convert to JPEG for sub-size generation. But first, the server needs to accept the upload.

How?

In WP_REST_Attachments_Controller::create_item_permissions_check(), bypass the $prevent_unsupported_uploads check when the uploaded file is HEIC/HEIF (detected via the existing wp_is_heic_image_mime_type() helper). This allows the file to be stored on the server, after which the client-side canvas fallback generates a JPEG version and all required sub-sizes.

Testing Instructions

  1. Use a WordPress environment where ImageMagick does NOT have HEIC support
  2. Upload a HEIC image via the REST API media endpoint
  3. Verify the upload succeeds (previously would return rest_upload_image_type_not_supported error)
  4. Verify missing_image_sizes is populated in the response (server couldn't generate sub-sizes)

Bypass the `wp_prevent_unsupported_mime_type_uploads` check
for HEIC/HEIF images so they can be stored even when the
server's image editor doesn't support them. The client-side
canvas fallback handles processing using the browser's
native HEVC decoder via createImageBitmap().
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props adamsilverstein.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@adamsilverstein adamsilverstein changed the title Media: Allow HEIC/HEIF uploads when server lacks image editor support Media: Enable HEIC/HEIF uploads when server lacks image editor support Mar 20, 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.

1 participant