AVIF support is not available in your version of PHP, since Kirby Update to 4

I’m having the same error in a similar scenario. I also updated from Kirby 3 to 4. locally avif is generated but once I upload to my server images are not generated and on right click opening the image in a new tab I get the “AVIF support is not available in your version of PHP” error.

PHP 8.2 is running on my server locally and with my hosting provider. Just to be sure I contacted my hosting provider and they told me IM and php 8.2 can be used for avif.

when i check php info i don’t see any mention for avif in GD, only in IM

GD Support 	enabled 
GD headers Version 	2.3.0
GD library Version 	2.3.0
FreeType Support 	enabled
FreeType Linkage 	with freetype
GIF Read Support 	enabled
GIF Create Support 	enabled
JPEG Support 	enabled
PNG Support 	enabled
WBMP Support 	enabled
XPM Support 	enabled
XBM Support 	enabled
WebP Support 	enabled
BMP Support 	enabled
TGA Read Support 	enabled 

for now i just changed the order in my responsive image snippet (based on the responsive images guide), so i’m just not using avif. But If I want to use avif, from what I understand I need to change from the default GD to IM as a general image engine. (How to switch from GD to ImageMagic as image engine?)

c::set('thumbs.driver', 'im');

could tell me where i would plug that line into my config.php? that would change the engine for all image generation to IM? from what i understand at least for thumbs() IM is already the default?

<?php 
return [
    'debug' => true,

    'thumbs' => [
        'srcsets' => [
            'default' => [
                '300w'  => ['width' => 300],
                '600w'  => ['width' => 600],
                '900w'  => ['width' => 900],
                '1200w' => ['width' => 1200],
                '1800w' => ['width' => 1800]
            ],
            'avif' => [
                '300w'  => ['width' => 300, 'format' => 'avif'],
                '600w'  => ['width' => 600, 'format' => 'avif'],
                '900w'  => ['width' => 900, 'format' => 'avif'],
                '1200w' => ['width' => 1200, 'format' => 'avif'],
                '1800w' => ['width' => 1800, 'format' => 'avif']
            ],
            'webp' => [
                '300w'  => ['width' => 300, 'format' => 'webp'],
                '600w'  => ['width' => 600, 'format' => 'webp'],
                '900w'  => ['width' => 900, 'format' => 'webp'],
                '1200w' => ['width' => 1200, 'format' => 'webp'],
                '1800w' => ['width' => 1800, 'format' => 'webp']
            ],
        ]
    ]
];
<?php foreach ($page->images()->sortBy('sort') as $image): ?>
    <figure>

        <?php $sizes = "(min-width: 1200px) 25vw,
                        (min-width: 900px) 33vw,
                        (min-width: 600px) 50vw,
                        100vw"; ?>

        <picture>
            <source
                srcset="<?= $image->srcset('webp') ?>"
                sizes="<?= $sizes ?>"
                type="image/webp"
            >

            <source
                srcset="<?= $image->srcset('avif') ?>"
                sizes="<?= $sizes ?>"
                type="image/avif"
            >
            <img
                loading="lazy"
                alt="<?= $image->alt() ?>"
                src="<?= $image->resize(300)->url() ?>"
                srcset="<?= $image->srcset() ?>"
                sizes="<?= $sizes ?>"
                width="<?= $image->resize(1800)->width() ?>"
                height="<?= $image->resize(1800)->height() ?>"
            >
        </picture>

        <figcaption><?= $image->caption() ?></figcaption>

    </figure>

<?php endforeach ?>