Comment 3 for bug 2031934

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thanks for taking the time to report this bug and trying to make Ubuntu better.

To triage this bug I created a Ubuntu Lunar (23.04) container and installed php, after that I ran the command you mentioned:

root@php-test:~# php -r 'imageavif(imagecreatefromjpeg(__DIR__ . "/foo.jpeg"));'
PHP Fatal error: Uncaught Error: Call to undefined function imageavif() in Command line code:1
Stack trace:
#0 {main}
  thrown in Command line code on line 1
root@php-test:~# php -i | grep AVIF

The error is different from what you presented. After some investigation, I noticed you need to install php8.1-gd package, and then you will get:

root@php-test:~# php -r 'imageavif(imagecreatefromjpeg(__DIR__ . "/foo.jpeg"));'
PHP Warning: imagecreatefromjpeg(/root/foo.jpeg): Failed to open stream: No such file or directory in Command line code on line 1
PHP Fatal error: Uncaught TypeError: imageavif(): Argument #1 ($image) must be of type GdImage, bool given in Command line code:1
Stack trace:
#0 Command line code(1): imageavif()
#1 {main}
  thrown in Command line code on line 1
root@php-test:~# php -i | grep AVIF
AVIF Support => enabled

The error above is expected because I had no image to be processed. And as you can see from the second command, the AVIF support is enabled. So please, if you want to use this function, install the php8.1-gd package and it should work for you.

Since this does not seem to me a bug in the package, I am marking it as Invalid. If you believe this is not the case, please mark it as New again and provide more information.