AVIF support is disabled

Bug #2031934 reported by Pierre Rudloff
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libgd2 (Ubuntu)
New
Wishlist
Unassigned

Bug Description

When trying to create an AVIF image:
php -r 'imageavif(imagecreatefromjpeg(__DIR__ . "/foo.jpeg"));'

It fails with this message:
PHP Warning: imageavif(): AVIF image support has been disabled

ProblemType: Bug
DistroRelease: Ubuntu 23.04
Package: php8.1-gd 8.1.12-1ubuntu4.2
ProcVersionSignature: Ubuntu 6.2.0-27.28-generic 6.2.15
Uname: Linux 6.2.0-27-generic x86_64
ApportVersion: 2.26.1-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: XFCE
Date: Fri Aug 18 19:04:40 2023
InstallationDate: Installed on 2021-02-02 (927 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
ProcEnviron:
 LANG=fr_FR.UTF-8
 PATH=(custom, no user)
 SHELL=/usr/bin/fish
 TERM=xterm-256color
 XDG_RUNTIME_DIR=<set>
SourcePackage: php8.1
UpgradeStatus: Upgraded to lunar on 2023-08-15 (3 days ago)

Revision history for this message
Pierre Rudloff (rudloff) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in php8.1 (Ubuntu):
status: New → Confirmed
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.

Changed in php8.1 (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Pierre Rudloff (rudloff) wrote :

I have php8.1-gd installed and "php -i | grep AVIF" does indeed declare that AVIF support is enabled but then I get an error saying it is not.

Changed in php8.1 (Ubuntu):
status: Invalid → New
Revision history for this message
Paride Legovini (paride) wrote :

Hello and thanks for this bug report. I can reproduce the issue as described.

The culprit is that avif support is disabled in src:libgd2, see:

libgd2 (2.3.3-9ubuntu1) mantic; urgency=low

  * Merge from Debian unstable. Remaining changes:
    - Drop the dependencies on libavif and libheif; libheif is blocked on a
      Main Inclusion Request, and libavif has an extensive rust dependency
      tree that makes it unsuitable for main.

There's a similar entry for lunar. I think this is valid wishlist bug for libgd2, so I'm changing the affected package.

affects: php8.1 (Ubuntu) → libgd2 (Ubuntu)
Changed in libgd2 (Ubuntu):
importance: Undecided → Wishlist
Revision history for this message
Paride Legovini (paride) wrote :

@Pierre: to set the correct expectations: should this be fixed at some point, the fix will not be backported to Ubuntu stable releases. If you really need avif, I suggest rebuilding libgd2 straight from Debian in a PPA (the "drop libavif" change is specific to Ubuntu).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.