Commit 5da08af3 authored by catch's avatar catch
Browse files

Issue #3532792 by nicrodgers, greg.harvey: avif error - Could not encode image: No codec available

(cherry picked from commit 240fe874)
parent 4cbf48e6
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -562,7 +562,9 @@ protected static function checkAvifSupport(): bool {
    }

    $tempFile = fopen('php://memory', 'r+');
    $supported = function_exists('imageavif') && imageavif(imagecreatetruecolor(1, 1), $tempFile, 0, 10) && fstat($tempFile)['size'] > 0;
    // We suppress any errors when running the imageavif command because of this
    // upstream php bug: https://bugs.php.net/bug.php?id=81217.
    $supported = function_exists('imageavif') && @imageavif(imagecreatetruecolor(1, 1), $tempFile, 0, 10) && fstat($tempFile)['size'] > 0;
    fclose($tempFile);

    return $supported;