WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#53645 new enhancement

Convert heic to a web safe image format.

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

Description

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 (7)

#2 @adamsilverstein
2 months 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
2 months 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
2 months ago

Looks like support was added to LibGD in v2.3 - https://github.com/libgd/libgd/issues/395.

Support will hopefully make it into the next PHP release via https://github.com/php/php-src/pull/5127 although that may have shifted to AVIF focus.

#5 @spacedmonkey
2 months 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
2 months 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
2 months 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.

Note: See TracTickets for help on using tickets.