AVIF support
Can you please prepare GD library with AVIF support.
It is supported from PHP version 8.1
Thank you for your input! We will consider this functionality in upcoming releases if it is popular. Everyone, please continue voting for this feature if you consider it important.
Now you can get compiled GD module with AVIF support here:
https://talk.plesk.com/threads/when-will-php-8-1-be-available.362959/
--
IG
-
Martin commented
Without any doubt, AVIF is a must nowadays.
There must be some major difficulties in implementing this, otherwise there is no reason not to support it right now. -
Pier Luigi commented
######## PART 1/3 ########
The problem with AVIF:
- PHP image manipulation is handled by two different software component (GD, ImageMagick) that use different libraries to support AVIF format (libavif, libde265, libheif)
- some "old" distros that Plesk still need to support, don't have those libraries available from their package manager, thus there is the need to manually compile them (with required dependencies)
- Plesk official AVIF support obviously need to be implemented for every Plesk supported platform and for all PHP supported versions and variant (fastcgi, fpm)After all the time passed from the initial request and initial AVIF PHP support (PHP 8.1 was released on November 2021) and despite the commercial product nature of Plesk software, it seems that the above task is still very complex.
That said, I've managed to implement AVIF support for both GD and ImageMagick in a special case:
- AlmaLinux 9.x (but it should work in similar RedHat based distros)
- PHP 8.1.x, PHP 8.2.x, PHP 8.3.x (PHP8.4.x actually fail with imagick extension compile)
- no IMAP PHP module support
- only fastgci PHP mode (fpm mode need some extra works that actually exceeds my knowledge)DISCLAIMERS:
I've tried to make the installation completely separated from the rest of the system with only minimal integration.
However, since I'm not an experienced Linux software developer/builder/maintainer use the following procedure at your own risk!Let's start with instructions for:
- PHP 8.3.14
- ImageMagick 7.1.1-41 -
Pier Luigi commented
######## PART 2/3 ########
Install epel repository
# sudo dnf install epel-release
# sudo dnf updateInstall compiler tools
# sudo dnf install gcc g++ cmake autoconf wgetInstall PHP dependencies
# sudo dnf install libxml2-devel sqlite-devel krb5-devel openssl-devel bzip2-devel libcurl-devel libdb-devel enchant-devel libpng-devel libwebp-devel libjpeg-devel libXpm-devel freetype-devel gmp-devel openldap-devel oniguruma-devel unixODBC-devel postgresql-server-devel aspell-devel libedit-devel net-snmp-devel libtidy-devel libxslt-devel libzip-develInstall AVIF support for PHP GD
# sudo dnf install libavif-develDownload PHP source
# wget https://www.php.net/distributions/php-8.3.14.tar.gz
# tar xzvf php-8.3.14.tar.gz
# cd php-8.3.14Configure PHP build (based on options used in official Plesk builds)
Note 1: we use a custom base path /opt/customphp/8.3/
Note 2: we not enable IMAP support because it require to download it's own source code
Note 2: we add --with-avif for GD./configure '--bindir=/opt/customphp/8.3/bin' '--runstatedir=/run' '--localedir=/opt/customphp/8.3/share/locale' '--localstatedir=/opt/customphp/8.3/var' '--libdir=/opt/customphp/8.3/lib64' '--docdir=/opt/customphp/8.3/share/doc' '--prefix=/opt/customphp/8.3' '--mandir=/opt/customphp/8.3/share/man' '--datadir=/opt/customphp/8.3/share' '--sbindir=/opt/customphp/8.3/sbin' '--exec-prefix=/opt/customphp/8.3' '--sysconfdir=/opt/customphp/8.3/etc' '--sharedstatedir=/opt/customphp/8.3/com' '--includedir=/opt/customphp/8.3/include' '--libexecdir=/opt/customphp/8.3/lib64' '--infodir=/opt/customphp/8.3/share/info' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--disable-debug' '--disable-gcc-global-regs' '--disable-rpath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-litespeed' '--enable-phpdbg' '--enable-re2c-cgoto' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-xml' '--with-bz2' '--with-config-file-path=/opt/customphp/8.3/etc' '--with-config-file-scan-dir=/opt/customphp/8.3/etc/php.d' '--with-enchant=shared' '--with-gettext' '--with-gmp' '--with-iconv' '--with-kerberos' '--with-layout=GNU' '--with-libdir=lib64' '--with-libxml' '--with-openssl' '--with-pic' '--with-system-tzdata' '--with-zlib' '--without-gdbm' '--without-pear' '--enable-bcmath=shared' '--enable-dba=shared' '--enable-dom=shared' '--enable-fileinfo=shared' '--enable-gd=shared' '--with-webp' '--enable-intl=shared' '--enable-mbregex' '--enable-mbstring=shared' '--enable-mysqlnd=shared' '--enable-pcntl' '--enable-pdo=shared' '--enable-phar=shared' '--enable-posix=shared' '--enable-soap=shared' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--with-curl=shared' '--with-db4=/usr' '--with-freetype' '--with-jpeg' '--with-ldap=shared' '--with-ldap-sasl' '--with-libedit' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=shared,mysqlnd' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared' '--with-pgsql=shared' '--with-pspell=shared' '--with-snmp=shared,/usr' '--with-sqlite3=shared' '--with-tidy=shared,/usr' '--with-unixODBC=shared,/usr' '--with-xpm' '--with-xsl=shared' '--with-zip=shared' '--without-readline' '--with-avif' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-strict-aliasing -pipe -Wno-unused-function' 'CPPFLAGS=' 'CXXFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
Build PHP
# makeInstall PHP
# sudo make installCopy php.ini file from Plesk
# mkdir /opt/customphp/8.3/etc/
# cp /opt/plesk/php/8.3/etc/php.ini /opt/customphp/8.3/etc/Exit from PHP source code directory
# cd ..Up to this point, only PHP GD has AVIF support.
-
Pier Luigi commented
######## PART 3/3 ########
Let's add ImageMagick with AVIF
# sudo dnf install libheif-develBonus (ImageMagick can also support JpegXL)
# sudo dnf install libjxl-develDownload latest source code (actually 7.1.1-41)
# wget https://www.imagemagick.org/download/ImageMagick.tar.gz
# tar xzvf ImageMagick.tar.gz
# cd ImageMagick-7.1.1-41Configure the build to use the same custom PHP path
# ./configure --prefix=/opt/customphp/8.3Make and install
# make
# sudo make installCheck ImageMagick AVIF support
# /opt/customphp/8.3/bin/convert -list format | grep AVIF
AVIF rw+ AV1 Image File Format (1.16.1)CHECK ImageMagick JPEG XL support
# /opt/customphp/8.3/bin/convert -list format | grep JXL
JXL* rw+ JPEG XL (ISO/IEC 18181) (libjxl 0.7.0)Exit from ImageMagick source code directory
# cd ..Install PHP imagick module
# wget https://pear.php.net/go-pear.phar
# /opt/customphp/8.3/bin/php go-pear.phar
(specify path /opt/customphp/8.3 if asked)Install imagick module
# PKG_CONFIG_PATH=/opt/customphp/8.3/lib/pkgconfig; sudo /opt/customphp/8.3/bin/pecl install imagick
(specify path /opt/customphp/8.3 if asked)As final step let's inform Plesk about the new custom PHP build
Copy all extension.ini files from Plesk equivalent version of PHP (thus you'll be able to enable/disable extensions from the plesk GUI)
# sudo cp -rf /opt/plesk/php/8.3/etc/php.d /opt/customphp/8.3/etc/
Remove IMAP initialization file (because we've not compiled it in custom PHP)
# sudo rm /opt/customphp/8.3/etc/php.d/imap.iniAdd the custom PHP fastcgi handler to Plesk
# sudo plesk bin php_handler --add -displayname 8.3.14-custom -path /opt/customphp/8.3/bin/php-cgi -phpini /opt/customphp/8.3/etc/php.ini -type fastcgi -id 8.3.14-fastcgi-custom -clipath /opt/customphp/8.3/bin/php(If you'll need to remove the handler just do: #sudo plesk bin php_handler --remove -id 8.3.14-fastcgi-custom )
Update Plesk GUI
# sudo plesk bin php_handler --reread
# sudo plesk sbin packagemng -sdfNow you can go to Domains -> {a_domain_name} -> PHP and choose the PHP version 8.3.14-custom as FastCGI application served by Apache.
Click the side link "View the phpinfo() page" and search for AVIF.
You should see:
GD -> AVIF Support : enabled
imagick -> ImageMagick supported formats -> ... AVIF ... JXL ... -
Carluccio commented
You really need to consider adding support for Avif, it performs better than Webp, and even Google is supporting it: https://developers.google.com/search/blog/2024/08/happy-avifriday
Please Plesk!
-
Sven Grossenbacher commented
Plesk must be dead asked for it 2 years ago... and still nothing???
-
Paksociety commented
Please add it
-
Anonymous commented
The performance for websites is huge with this upgrade. Please support the image type in Plesk :)
-
Martin commented
this is mandatory now ... also google suggests using it.
-
Agruo Studio commented
No puedo entender como a estas alturas seguimos sin sin soporte para AVIF
-
Pablo Andres Subiabre Freixas commented
Tengo urgencia ya que estoy implementando un proyecto nuevo en WordPress y me piden tener habilitada esta opción. Elegí trabajar con un VPS de Axarnet y desde mi desconocimiento de Plesk, ya que venía de hosting con cPanel, creí que esto ya venía habilitado. ME gustaría saber para cuando tendrán implementado esta actualización. Muchas gracias.
-
Hailie commented
Any news on this?
-
Benno Yorck commented
Please add AVIF support to Plesk
-
Sally Griffith-Oh commented
Please add AVIF support to Plesk - would be very helpful for WordPress, which now supports AVIF format.
-
di ma commented
Please add the AVIF support, it is well supported now
-
Jens Sonnenberg commented
Please add the AVIF support, it is well supported now
-
Kyrill commented
WordPress now support the AVIF format. Please include AVIF support in the next update.
-
olivia commented
Microsoft Edge will soon be released with AVIF support, then all browsers will be able to do this.
Please turn on avif support by default now. -
Karl May commented
Would be great to get the support in a timely manner so you can work with it. I am already receiving the first complaints. Most major browsers already support the format.
-
Martin commented
All CMS we work with support AVIF, but not Plesk.
Please AVIF support with the next update.