Koozali.org: home of the SME Server

AVIF image support for PHP 8.3 GD

Offline wdepot

  • ****
  • 95
  • +0/-0
    • http://westerndepot.com
AVIF image support for PHP 8.3 GD
« on: November 24, 2024, 12:03:33 AM »
I'm updating a web site to work with PHP 8.3 and one of the things that was wanted was support for AVIF images, specifically resizing them using GD in PHP. I finished the work for the resizer and tested it to work fine for other image formats but the moment I tried to load an AVIF image it failed to load the image at all which surprised me since AVIF support was supposed to have been added to GD beginning in version 8.1 of PHP. When I used phpinfo() to check the information listed for GD I noticed that AVIF wasn't even mentioned. Is there a way to update the GD version for php-fpm now that SME 10 is past end of life or will I need to wait until SME 11 becomes available?

Offline ReetP

  • *
  • 3,881
  • +5/-0
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline wdepot

  • ****
  • 95
  • +0/-0
    • http://westerndepot.com
Re: AVIF image support for PHP 8.3 GD
« Reply #2 on: November 28, 2024, 01:05:45 AM »
Always worth a quick read around.

"remi php gd avif"

https://stackoverflow.com/questions/71739530/php-8-1-imageavif-avif-image-support-has-been-disabled#71739929

It's a upstream RH/CentOS thing.

https://rpmfind.net/linux/RPM/remi/enterprise/7/x86_64/gd3php-2.3.3-7.el7.remi.x86_64.html

I used yum info to check the version of gd3php and it matches the version listed above. It looks like I might need to figure out how to use the Imagick class to accomplish what I was hoping for. I'll have to try and figure out how to pad an image when needed since I didn't spot copying one image into another blank white image at first glance though I suspect it is there somewhere.

I figured out how to install Imagick7 for PHP 8.3 but installing the needed Imagick7-heic failed  because
Code: [Select]
Error: Package: libheif-1.4.0-1.el7.remi.x86_64 (remi-safe)
           Requires: libde265.so.0()(64bit)
Where do I get libde265.so.0 since it is apparently not in any enabled repository?

Also do you happen to know if the Rocky Linux 9 that will be used in SME 11 will have libavif for gd since it is sort of a sidestep around Red Hat 9?

Offline bunkobugsy

  • *
  • 299
  • +4/-0
Re: AVIF image support for PHP 8.3 GD
« Reply #3 on: November 28, 2024, 05:37:37 AM »
Also do you happen to know if the Rocky Linux 9 that will be used in SME 11 will have libavif for gd since it is sort of a sidestep around Red Hat 9?

SME 11 -> Rocky 8, SME 12 -> Rocky 9, but you could try yourself https://wiki.koozali.org/Sme11BuildQueue#Bare_install_test
« Last Edit: November 28, 2024, 07:33:42 AM by bunkobugsy »

Offline ReetP

  • *
  • 3,881
  • +5/-0
Re: AVIF image support for PHP 8.3 GD
« Reply #4 on: November 28, 2024, 05:05:38 PM »
I used yum info to check the version of gd3php and it matches the version listed above.

OK - so the Remi package has that support it appears. RH/CentOS do not.

Have you actually tested it? Read the changelog in the rpm and the related bugs. Read here.

https://rpmfind.net/linux/RPM/remi/enterprise/7/x86_64/gd3php-2.3.3-7.el7.remi.x86_64.html

https://libgd.github.io/

Quote
It looks like I might need to figure out how to use the Imagick class to accomplish what I was hoping for.

Why if you have what you wanted above?

You are hopping from thing to another without really testing anything.

Quote
I figured out how to install Imagick7 for PHP 8.3 but installing the needed Imagick7-heic failed  because
Code: [Select]
Error: Package: libheif-1.4.0-1.el7.remi.x86_64 (remi-safe)
           Requires: libde265.so.0()(64bit)
Where do I get libde265.so.0 since it is apparently not in any enabled repository?

Why do that? That wasn't what you originally asked?

A bit of searching helps you find stuff. Some patience and 5 minutes detective work.

Assuming that this is what you really need to do......

You can see the libheif rpm here:

https://rpmfind.net/linux/RPM/remi/enterprise/7/x86_64/libheif-1.4.0-1.el7.remi.x86_64.html

You can click the requires links which gets you to here:

https://rpmfind.net/linux/rpm2html/search.php?query=libde265.so.0()(64bit)

Which tells you it is likely here:

"RpmFusion Free Updates for RedHat"

So you can look in the wiki for rpmfusion and find this here:

https://wiki.koozali.org/Rpmfusion

And unsurprisingly there is an extrarepo rpm here:

https://wiki.koozali.org/Extrarepositories


Quote
Also do you happen to know if the Rocky Linux 9 that will be used in SME 11 will have libavif for gd since it is sort of a sidestep around Red Hat 9?

I already posted you links about this earlier.

Rocky essentially just rebuild RHEL for compatibility. If it isn't there in RHEL it likely won't be there in Rocky, hence extra repos like Remi.

It's an upstream thing. Nothing to do with us. RH/CentOS often remove things or change things that don't fit in with their business. There is a lot of law around some of these image types and the compressors and they may be avoiding that, or wanting to sell their own packages to resolve it.

https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format

Personally I'd avoid it like the plague.

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Jean-Philippe Pialasse

  • *
  • 2,852
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: AVIF image support for PHP 8.3 GD
« Reply #5 on: December 03, 2024, 03:10:11 PM »
php83 -i | grep AVIF
returns nothing

on rhel8 /rocky8 it does return that it is enabled but there was for long time no libavif available. sound like remi provides it now.

to install imagick7 you need deps from rpmfusion.


see https://stackoverflow.com/questions/71739530/php-8-1-imageavif-avif-image-support-has-been-disabled