Hi Azurel, hi Myrlo,
short version: Plesk staff said there are no plans for AVIF in their Imagick package (feature request), so everything below is unsupported/self-managed. But it doesn't have to mean recompiling PHP. Depending on where the ImageMagick library comes from, it may be just a missing coder module.
Background (this is how ImageMagick works, not Plesk-specific): AVIF goes through the "heic" coder, which needs libheif, and libheif needs an AV1 codec for encoding (aom, rav1e or SVT-AV1). That's why on Ubuntu reading worked out of the box and encoding needed the aomenc plugin, as Myrlo found. Azurel's phpinfo shows no AVIF at all, not even for reading, which suggests that on Alma the whole heic coder is missing or not loadable. That's my interpretation, not a confirmed fact.
Step 1 - find out what Plesk's Imagick really uses:
Code:
/opt/plesk/php/8.5/bin/php -r 'print_r(Imagick::getVersion()); print_r(Imagick::queryFormats("*AVIF*")); print_r(Imagick::queryFormats("HEIC"));'
Code:
rpm -qf $(ldd /opt/plesk/php/8.5/lib64/php/modules/imagick.so | awk '/agick/ {print $3; exit}')
rpm -qa | grep -i -E 'magick|heif|avif|libaom|dav1d|rav1e|svt'
Step 2 - check for the coder module and for a policy that blocks it:
Code:
find /usr /opt -name 'heic.*' 2>/dev/null
grep -i -E 'heic|avif|heif' /etc/ImageMagick*/policy.xml
How to read the results:
a) The library comes from a normal repo package (not from /opt/plesk) and there is no heic coder: then a separate coder package may exist for exactly that ImageMagick version. For example Remi splits it out (the cPanel thread shows "ImageMagick6-heic" from Remi, so by that naming there should be an ImageMagick7-heic, please check, I haven't verified it):
Code:
dnf list --enablerepo=remi 'ImageMagick7*'
Please don't enable such a repo permanently on a Plesk server, because it can pull in newer libs than Plesk expects. Use --enablerepo only for that one install and make sure the version matches your library exactly (7.1.2-30), otherwise the module won't load.
b) heic coder is there, but AVIF is still not listed: then libheif has no AV1 codec. Check the output of the rpm -qa line for libheif and libaom (or rav1e / SVT-AV1).
c) The ImageMagick library is shipped by Plesk itself (path under /opt/plesk): then a system-wide coder won't be picked up, and you are at the self-managed options below.
After any change restart the PHP-FPM service of that version and test again with the first command:
Code:
systemctl restart plesk-php85-fpm
If a)-c) don't work out, the options are:
1. Let GD do the AVIF part (it is enabled in your PHP, as Azurel wrote), as scsa20 suggested. Only the AVIF calls need to change.
2. Install a separate ImageMagick 7 with AVIF support (or an AVIF encoder tool) and call it from your application via the command line, if exec() is allowed for your site. This leaves Plesk's PHP packages untouched.
3. A self-built PHP/Imagick, which is self-managed and where you are responsible for updates.
Whatever you choose, please also vote for the feature request on features.plesk.com, as Sebahat asked. And it would be interesting to see the output of the first two commands here, then we know where Plesk's ImageMagick 7.1.2-30 actually comes from.
Regards
Tessa