Skip to content

Conversation

@freshleafmedia
Copy link
Contributor

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

@Hao-Wu
Copy link

Hao-Wu commented Dec 9, 2020

@freshleafmedia Will support for AVIF result in supporting for HEIC?
Do we need a similar encoder declaration with what you've done in this PR.

@freshleafmedia
Copy link
Contributor Author

@Hao-Wu No, you're right an additional declaration will be required

*/
protected function processAvif()
{
throw new NotSupportedException(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
    }

Copy link

@JoyceBabu JoyceBabu Jul 3, 2021

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.

https://bugs.php.net/bug.php?id=80828

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)

Copy link

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. ☺️

@olivervogel olivervogel merged commit b349463 into Intervention:master Jul 5, 2021
@freshleafmedia freshleafmedia deleted the feature/avif-support branch August 5, 2021 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HEIC formatt file is not supported

6 participants