CodeIgniter Forums
Upload library error with new Apple file format and HEIF - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Upload library error with new Apple file format and HEIF (/showthread.php?tid=75634)



Upload library error with new Apple file format and HEIF - nicolas33770 - 02-28-2020

Good morning all,

I use the upload library to manage the sending files on my responsive website. 

I wish send photos from my iPhone but the new Apple file format doesn't seem to work. Do you know how to correct this problem please?

$ config ['allowed_types'] = 'gif | jpg | JPG | jpeg | JPEG | png | PNG | heic | HEIC | heif | HEIF';
$ this-> load-> library ('upload', $ config);


Thank you.

I wanted to add some strange information. Using the following configuration, the HEIC format image is sent correctly from my iPhone while Mime type is not allowed. It doesn't work from a computer even adding HEIC in allowed_types ...

$ config ['allowed_types'] = 'gif | jpg | JPG | jpeg | JPEG | png | PNG';


RE: Upload library error with new Apple file format and HEIF - zahhar - 02-28-2020

In my answer I assume you are using File Upload Class in CI3.

1. Try to remove all allowed_types at all, to check if file can be uploaded without that limitation. Probably HEIC/HEIF file is too large and goes beyound file upload limits defined in your php.ini
2. Try to add the following 3 extentions to allowed_types: avci, heics to support HEIF files that contain image sequences.

So your code should be (all lowercase is sufficient):
PHP Code:
$config['allowed_types'] = 'gif|jpg|jpeg|png|heic|heif|heics|avci'



RE: Upload library error with new Apple file format and HEIF - InsiteFX - 02-28-2020

You need to check the app\Config\Mimes.php to see if the mime type is in it if not
then you need to add the new mime type to the Mimes.php file.

You can get the mime type for HEIF from here.

HEIF Related Brands and MIME Types

HEIC R Apple High efficiency Image Format HEIC requires the libheif delegate library.


RE: Upload library error with new Apple file format and HEIF - nicolas33770 - 02-28-2020

Thanks it's ok I add this to the file Mimes.php

Code:
    'heic'     =>    'image/heic',
    'heif'     =>    'image/heif'



RE: Upload library error with new Apple file format and HEIF - albertleao - 02-28-2020

(02-28-2020, 06:26 AM)nicolas33770 Wrote: Thanks it's ok I add this to the file Mimes.php

Code:
    'heic'     =>    'image/heic',
    'heif'     =>    'image/heif'


If you made a pull request to the ci3 repo on github, you could probably help a lot of us Smile. I've done it for a few file formats and had it merged fairly quickly.


RE: Upload library error with new Apple file format and HEIF - nicolas33770 - 02-28-2020

I never do that but it will be cool. I don't know how it's work to push modification like this... I make I try but sourcetree give me an error

Code:
Pushing to https://github.com/bcit-ci/CodeIgniter.git
remote: Permission to bcit-ci/CodeIgniter.git denied to wobility.
fatal: unable to access 'https://github.com/bcit-ci/CodeIgniter.git/': The requested URL returned error: 403

In addition to what I said, I would like to add that the behavior of the iPhone is specific, because the file sent from the iPhone does not seem to be in HEIC format? Because it works from an iPhone but not from my computer. Maybe a modification on the fly before sending, I don't know.


RE: Upload library error with new Apple file format and HEIF - albertleao - 02-28-2020

You'll have to create a branch in github, make the change, then do a pull request. This is a simple enough change you could probably do it all within the Github interface.

If it's your first time you can read this: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request

Pretty good skill to know Smile. Also you'll have contributed to the framework!


RE: Upload library error with new Apple file format and HEIF - nicolas33770 - 02-29-2020

I do directly with Github, I think is ok !? https://github.com/bcit-ci/CodeIgniter/pull/5918

Thanks for your help, I really love CodeIgniter !