phpgdavif

PHP 8.1 imageavif(): AVIF image support has been disabled


PHP 8.1.4 (Installed via remi repo) runing on CentOS 8 Stream

I tested avif support on the machine:

php -i | grep AVIF
AVIF Support => enabled

php -r 'echo gd_info()["AVIF Support"];'
1

if (function_exists("imageavif")) {echo "tes";}else{echo "no";}
yes

It looks ok, but when I use "imageavif" function, I got this warning:

Warning: imageavif(): AVIF image support has been disabled

I'm confused... Tests saids "AVIF Support => enabled", and scripts saids disabled...

How can I enable it??

My tries:

php -r 'var_dump(imageavif(imagecreatetruecolor(8, 8), "/tmp/test"));'

Solution

  • CentOS 8 (and 9) don't have libavif, so the support cannot be enabled in libgd.

    BTW, by design, the function is always there, but fails.

    AVIF format is available using the imagick or vips extensions using the libheif library

    Using my repository, you need

    or