-
-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 8.1 with AVIF Support in GD extension #834
Comments
It's not yet possible due to a bug (segmentation fault), see https://bugs.php.net/bug.php?id=81217 Even my alternative, what use a recent version (8.1.0beta3) is not able to add gd with AVIF support. |
@llaville Thx for pointing this out. Hopefully at some point this will work. While this is currently not possible perhaps you have an idea how to tackle this. $finfo = finfo_open( FILEINFO_MIME_TYPE );
$file_mime_type = finfo_file( $finfo, $value['file_path_avif'] );
finfo_close( $finfo );
dump( $file_mime_type ); This naturally returns application/octet-stream as mime type and is wrong. Solution - I had to get the file contents as a string and then 8 characters starting at 4. // https://www.php.net/manual/en/function.file-get-contents.php
$avif_file_contents = file_get_contents( $value['file_path_avif'], false, null, 4, 8 );
dump( $avif_file_contents );
if ( 'ftypavif' === $avif_file_contents ) {
echo $avif_file_contents;
echo 'This is an AVIF file.';
} 🤞 this will not give any false results.. |
@robots4life Good news. Project And I've already mentioned it, my alternative which is almost compatible to https://github.com/devilbox/docker-php-fpm (see my current ROADMAP to learn more about compatibility between two solutions) used the |
@llaville Good work and thank you for the update on this. For local development this is good, going live, many hosts have not implemented this and imo this will still take a while. For working with JPEG files and converting them to AVIF I can observe a trend where some basic PHP hosts have Node on the console, with this I pass the files to the Node process, convert them there with Sharp and pass them back to the location where PHP can serve them. This works locally and live for the hosts in question. However, it would also be cool to know if the |
/cc @cytopia |
The GD extension in PHP 8.1 and later supports the AVIF image format, making it possible to convert images from and to AVIF.
For this to work the GD extension must be compiled with AVIF support.
It depends on libavif package, which may not be available in default repositories of older operating system versions.
https://php.watch/versions/8.1/gd-avif#compile
Could you kindly compile PHP 8.1 with AVIF support ?
The text was updated successfully, but these errors were encountered: