Welcome Guest, Not a member yet? Register   Sign In
Add AVIF and HEIF MIME types to Config/Mimes.php
#1

(This post was last modified: 10-18-2023, 01:47 AM by Muzikant.)

Hi. I am using \CodeIgniter\Files\File\guessExtension() to identify, if a file is an image and this function is also based on MIME types. I realized, an AVIF type is not in the Config\Mimes.php file. This image format is included in Mozilla's common image file types. As it is more and more popular now, what about including it?

AVIF MIME types (Wikipedia / right column):
Code:
image/avif


There is also missing HEIF type, which is commonly used on Apple devices. It is not open format (HEIF patent licensing), but as there are CDR and AI formats, it should not be a problem. This format is also widely used, so what about including it too?

HEIF MIME types (Wikipedia / right column):
Code:
image/heif, image/heif-sequence;
image/heic, image/heic-sequence;
image/avif

Yes, there is an image/avif in HEIF too, but this should be an identifier for AVIF format (Wikipedia is not perfect).
Reply
#2

You should be able to add them to app/Config/Mimes.php like so, this is the way we use to do it.
PHP Code:
        'heif' => [
            'image/heif',
        ],
        'heic' => [
            'image/heic',
        ],
        'avif' => [
          'image/avif',
        ], 
What did you Try? What did you Get? What did you Expect?

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

(This post was last modified: 10-20-2023, 02:36 AM by Muzikant.)

Of course I can. We are in Feature Requests, not in Support category. This is my two cents to improve framework I like. I made a good points these two types should by added generally.
Reply
#4

(This post was last modified: 10-20-2023, 09:42 PM by InsiteFX.)

point taken.

Why not make a pr on CodeIgniter GitHub?

or

Submit an issue if you can not make a pr.
What did you Try? What did you Get? What did you Expect?

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

I am not registered on GitHub, because it is owned by Microsoft.
Reply
#6

(This post was last modified: 10-27-2023, 03:15 AM by Moon757. Edit Reason: Rectifying )

You can add AVIF and HEIF MIME types to Config/Mimes.php by editing the file and adding the corresponding MIME types for these formats.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB