1

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"));'
xforce
  • 13
  • 3

1 Answers1

2

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

  • php-pecl-imagick-im7, ImageMagick7-heic and libheif from rpmfusion.org

or

Remi Collet
  • 6,198
  • 1
  • 20
  • 25
  • Thank you! I tried "dnf install libavif-devel" and came out an error: "Unable to find a match: libavif-devel" Seems libavif only avaible on Debian/Ubuntu & Fedora/RHLE? Is there any way I install it on CentOS? – xforce Apr 05 '22 at 07:21
  • Alternative solution using imagick/vips way added to above answer – Remi Collet Apr 05 '22 at 09:27
  • To have lilbavif in CentOS, you can try to ask on https://bugzilla.redhat.com/ to have it added to EPEL repository – Remi Collet Apr 05 '22 at 09:29
  • See https://bugzilla.redhat.com/2071940 – Remi Collet Apr 05 '22 at 09:32