Welcome Guest, Not a member yet? Register   Sign In
Upload library error with new Apple file format and HEIF
#1

(This post was last modified: 02-28-2020, 02:28 AM by nicolas33770.)

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';
Reply
#2

(This post was last modified: 02-28-2020, 05:22 AM by zahhar.)

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'
Reply
#3

(This post was last modified: 02-28-2020, 06:19 AM by InsiteFX.)

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

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

Code:
    'heic'     =>    'image/heic',
    'heif'     =>    'image/heif'
Reply
#5

(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.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#6

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.
Reply
#7

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/collab...ll-request

Pretty good skill to know Smile. Also you'll have contributed to the framework!
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#8

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 !
Reply




Theme © iAndrew 2016 - Forum software by © MyBB