dlebedef's avatar

Handle HEIC images

So my question is quite simple: how do I handle HEIC images? Validation in forms using mimes doesn't seem to work with heic as it is not available in the mimes types list.

I need to be able to upload photos from phones and then display them on the website. Of course conversion to other formats is fine with me, but I can't find anything that I could implement...

0 likes
8 replies
bobbybouwmann's avatar

The mimetype should be any of these image/heif, image/heic, image/heif-sequence, image/heic-sequence. On your server you need to make sure you have imagick installed and enabled. Imagich is a image processing library for PHP.

After that you should be able to use a package like intervention/image to handle the file uploads and convert the image back to jpg.

http://image.intervention.io/getting_started/installation

2 likes
dlebedef's avatar

@BOBBYBOUWMANN - Hi, thanks for the answer! Unfortunately, even after installing intervention/image I'm sstill struggling...I would like to save the image as jpg but I can't make it work.

In my case I receive an array of images through a form:

foreach ($request->file('photos') as $key => $photo) {
    Image::make($photo)->resize(300, 200)->save('path_to_folder/foo.jpg');
}

I get this:

NotReadableException in Decoder.php line 26:
Unable to read image from path (/tmp/phpwwJ3RJ).

Any idea on how to move on?

eresources's avatar

I have the same issue. Imagick works fine with JPEG, PNG, etc. But HEIC images break it. I think there is a way to install imagick specifically with HEIC support but I don't want to break everything and hate doing full re-installs and messing with .ini files if I don't have to. Anybody have any further insight on this?

1 like
Firemaps's avatar

Any update? I am also stuck with this. Will report back...

1 like
vdvcoder's avatar

Any new idea's? Also stuck with this problem. Clients want to upload images from Iphone in HEIC format.

Please or to participate in this conversation.