Support for HEIC images

We have a lot of users uploading files. Apparently they are HEIC file from iPhone.

Is there a way to have these display inline for the post? (assuming this isn’t supported right now?)

2 Likes

Looks like this is a browser limitation:

https://caniuse.com/#feat=heif

heif covers both heif and heic and there’s No support for either in any mainstream browser at present

3 Likes

Ugh. So annoying Apple.

I’d say #pr-welcome for allowing users to upload those and converting those from HEIC to JPEG.

8 Likes

Is there an existing pipeline that does something similar that you could point a contributor to?

6 Likes

There is this:

And there are some accompanying specs at upload_creator_spec.rb.

10 Likes

I think this would be a really awesome upgrade and doesn’t look like HEIC is going away…Thanks if someone can figure it out!

To be clear this won’t add HEIC support. Images will be converted using a different lossy method and lose a tiny bit of fidelity in the process.

Any live photos shared as HEIC will become a still image, and while HEIC can support transparency, JPEG does not.

The equivalent JPEG is about twice the size.

8 Likes

Understand. I’m ok with the tradeoffs.

1 Like

Any traction on this one?

Not at the current time, no. Did you want to sponsor the feature or submit a PR?

I took a crack at this yesterday. I work on a Mac, and this was pretty straightforward on my machine, so I set up this PR: FEATURE: Support converting HEIF images to JPEG by pmusaraj · Pull Request #10079 · discourse/discourse · GitHub however ImageMagick on Linux machines does not come with HEIC support out of the box, so we can’t merge this until we update the base Docker image to include HEIC support.

I’ll work on that now, but this will take a bit longer to get to core.

13 Likes

This feature is now merged in core and the base image bas been updated.

To enable HEIC/HEIF support, you need to:

  • enable the convert heif to jpeg site setting
  • add heic and/or heif to the authorized extensions for uploads on your site

If you are hosted with us, this feature should be available already (if it isn’t, shoot us a quick message).

For self-hosters, you need to update the base image and rebuild:

cd /var/discourse
git pull
./launcher rebuild app
4 Likes

Do you mean the site setting is enabled by default on our hosting?

No, it’s not enabled by default, I just meant that the new setting should be there on our hosting.

2 Likes

Is there any reason it should not be enabled by default on our hosting?

1 Like

Does it even need to be a setting?

Discourse isn’t a file manager, if people want to share the HEIC files they could just link to it hosted elsewhere?

I can’t see it doing any significant harm?

1 Like

I guess you’re right, the setting only adds a hurdle. It’s easy to remove.

Should we also add .heif/.heic to the default authorized extensions site setting @codinghorror?

3 Likes

Sure, whatever is easiest works for me!

3 Likes

Ideally this should just work out of the box, right?

Other uploads are already optimized, HEIC is just being optimized ‘a little further’ to cater for browser compatibility issues.

4 Likes