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...
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.
@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).
Mmh, are you sure you have imagick installed and enabled?
Also there are alternative libraries, but they are not build in PHP so you have to run them as a command instead. For example: https://github.com/monostream/tifig
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?