Allow uploading of AVIF image formats

I have a jpeg which is of 50KB. I used ImageMagick to convert it from jpeg to avif

magick.exe tevaram.jpeg tevaram.avif

But I get You can’t upload files of this type.

image

My event.yaml file :

fields:
    image:
        label: Event Image
        type: fileupload
        mode: image
        imageWidth: 1200
        imageHeight: 800
        thumbOptions:
            mode: crop
            width: 300
            height: 200
        comment: Optional - event poster or image

How do I get mode: image to accept AVIF image formats ? Its supported by all browsers now - since 2 years I believe.

Hi @anjanesh ,

Does this help?

Thanks - that alone was not enough -

'image_extensions' => ['avif', 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'svg'],

Native support for AVIF has been added in October CMS v4.1.4+

You’ll still need to do that config change.

Thanks!

1 Like

With latest OC version 4.2.20, when client uploaded a PNG image through backend, I get this exception using PHP 8.3.29

 class: "Error",
        message: "Call to undefined function Intervention\Image\Drivers\Gd\Decoders\imagecreatefromavif()",
        code: 0,
        file: "~/vendor/intervention/image/src/Drivers/Gd/Decoders/FilePathImageDecoder.php",
        line: 38,

Looks like the gd extension isn’t enabled

the funny thing is that the client managed to upload other png images within the same model.

Yes, the extensions are individual for the type. So PNG is enabled but AVIF may not be