-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for HEIC uploading + JPEG conversion #7034
Add support for HEIC uploading + JPEG conversion #7034
Conversation
First pass, excluding tests
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 Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Thanks for the PR @adamsilverstein. It doesn't seem to work when I test it, though. If I drop a .heic into the gallery I see an error, the image cannot be previewed, and the file type is still Kapture.2024-07-16.at.11.44.18.mp4 |
src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
Outdated
Show resolved
Hide resolved
src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
Outdated
Show resolved
Hide resolved
Here's a fix for the Image block: WordPress/gutenberg#63643 |
Interestingly, in my project I just saw some differences in the browser tests where the browser-determined mime type was once I don't know how the mime type detection works in PHP, but it might be worth testing this with a few different HEIC images to see if the HEIC images have a different FourCC code depending on the type:
|
Co-authored-by: Robert Anderson <robert@noisysocks.com>
…ss-develop into add/heic-support
|
Currently I'm using this bit of code which I haven't really verified works beyond a single test image. This will be important to test throughly because PHP won't properly detect the mime type. I plan to add tests next and can bundle several test images to make sure they are identified correctly (and hopefully that we can get the sizes correctly with Imagick). I'll be looking for test images that have a compatible license and are relatively small, contributions welcome! |
Amazing, thank you! |
Worth noting that I tried uploading heif from https://filesampleshub.com/format/image/heif. I was unable to upload and I get this error message. |
Thanks for the link to the sample files, that is helpful. I could try to extend full support to .heif files. Do we know how common these are or where/how they are created? I double checked and the files my iphone was creating before I switched it off were .heic files. |
As an experiment I took a
I think it makes sense to have WordPress do the same. Support both |
Added some tests @adamsilverstein. I think coverage is okay, though I struggled to write one for the changes to Something strange I noticed is that our PHP 8.3 container in GitHub Actions doesn't have the Imagick extension enabled but the other containers do 🤷♂️ |
This still tests really well for me. Here's how things look now that WordPress/gutenberg#63643 is merged. Kapture.2024-08-02.at.12.11.55.mp4I'll commit on Monday if there's no objections. Keen to get something in early for 6.7 so that there's plenty of time for feedback and iteration. |
Committed in r58849. |
First pass, excluding tests
Trac ticket: https://core.trac.wordpress.org/ticket/53645
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.