-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
AVIF Support #1056
AVIF Support #1056
Conversation
@freshleafmedia Will support for AVIF result in supporting for HEIC? |
@Hao-Wu No, you're right an additional declaration will be required |
*/ | ||
protected function processAvif() | ||
{ | ||
throw new NotSupportedException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, GD supports avif: https://github.com/libgd/libgd/releases/tag/gd-2.3.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@freshleafmedia could you update this file to include the GD support?
protected function processAvif()
{
if ( ! function_exists('imageavif')) {
throw new NotSupportedException(
"Avif format is not supported by PHP installation."
);
}
ob_start();
imageavif($this->image->getCore(), null, $this->quality);
$this->image->mime = defined('IMAGETYPE_AVIF') ? image_type_to_mime_type(IMAGETYPE_AVIF) : 'image/avif';
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AVIF Support is not yet available in PHP GD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not quite accurate, php/php-src#7026 is merged so GD with avif will be available in the next patch version (8.1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're both right. AVIF is now supported in libgd. The support in PHP is now merged, and it's set to be released in PHP 8.1.
This PR adds support for the AVIF encoding.
The AVIF format has been supported in ImageMagick since at least 7.0.10-21. I personally have tested it on 7.0.10-25 along with this person.
This closes #891