Make WordPress Core

Opened 3 years ago

Last modified 2 weeks ago

#53645 new enhancement

Convert heic to a web safe image format.

Reported by: spacedmonkey's profile spacedmonkey Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords: needs-patch
Focuses: Cc:


As of ios 11, Apple start using the HEIF format to save images. Sadly HEIF files can not be viewed in web browsers. For those taking images on their iPhone, this would mean to embed a raw iPhone photo, would require them to use a third party tool to convert that image into a web safe format like jpeg.

WordPress core should convert this image to a web safe format while keeping the original for reference.

Change History (9)

#2 @adamsilverstein
3 years ago

Great suggestion @spacedmonkey!

Questions: What happens when users upload an HEIF image currently? Are there other formats users might try to upload we should think about when building this? Do both GD and Imagick support HEIF?

#3 @spacedmonkey
3 years ago

Seems like Imagick does support handling HEIF but PHP GD does not. There seems to be a PHP library that may help here called Intervention Image. There is a javascript library called Heic2any.

I am not sure if this would have to be an opt in feature or not. Would it be okay if the feature worked only if you use imagemagick.

#4 @adamsilverstein
3 years ago

Looks like support was added to LibGD in v2.3 -

Support will hopefully make it into the next PHP release via although that may have shifted to AVIF focus.

#5 @spacedmonkey
3 years ago

@adamsilverstein Good find. Seems like it there is support was added in 2.3.2.

Meaning both image libraries do support it. Do we need to wait a while for this library versions to be more popular?

Can we add this as a projective enhancement like webp?

#6 @adamsilverstein
3 years ago

we should be able to treat this as a progressive enhancement. If the server supports HEIC, add the feature. We can start with a POC, I'd like to see if my local setup supports this.

#7 @desrosj
3 years ago

I have to admit that I am pretty hesitant to start converting uploaded images into different formats just because they are not web friendly.

I know that the ability to map mime types is new, but we haven't done this in the past with other formats. It's also perfectly reasonable to expect someone to want the original format of the image to persist.

On one hand, it would be great to upload any image they find and not have to worry about it being usable/visible to their users, but on the other hand there is value in the user being aware of the fact that the image they're uploading is not a widely supported format.

Also, where do we draw the line? TIFF is not supported by Firefox, JPEG 2000 is only supported by Safari. If we start building a list of mime types that we map, there's the potential to create a web that will be a maintenance headache.

To be clear, I think this is a great idea, but I am hesitant to add this to Core as the default without considering the implications of this more broadly.

#8 @spacedmonkey
2 weeks ago

I know that @swissspidy has been working on this as part of media-experiments. I wonder if he is interested in picking this up.

#9 @swissspidy
2 weeks ago

Indeed I have.

There are multiple ways to go about this, for example it can be opt-in, opt-out, or opt-in with a confirmation dialog the first time you upload such an image. So there are some UX considerations.

Right now in my project it's on by default (opt-out) but am considering changing it to be more flexible.

Either way, this project still a long way until this is ready for prime time, and that will have to go through Gutenberg anyway.

Note: See TracTickets for help on using tickets.