From 93b4f5b4153c60def40f3d129f8562bdbbcc1cbe Mon Sep 17 00:00:00 2001
From: catch <6915-catch@users.noreply.drupalcode.org>
Date: Wed, 28 May 2025 10:15:22 +0100
Subject: [PATCH] Issue #3526690 by cilefen, xmacinfo, andypost, grimreaper,
 mstrelan: Call to undefined function
 Drupal\system\Plugin\ImageToolkit\imageavif()

(cherry picked from commit a00c032ce6d8d790f6cbd8c304d7cfbd10e9a20f)
---
 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php b/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
index 98c1a093a440..2ce434e0fd3d 100644
--- a/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
+++ b/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
@@ -562,7 +562,7 @@ protected static function checkAvifSupport(): bool {
     }
 
     $tempFile = fopen('php://memory', 'r+');
-    $supported = imageavif(imagecreatetruecolor(1, 1), $tempFile, 0, 10) && fstat($tempFile)['size'] > 0;
+    $supported = function_exists('imageavif') && imageavif(imagecreatetruecolor(1, 1), $tempFile, 0, 10) && fstat($tempFile)['size'] > 0;
     fclose($tempFile);
 
     return $supported;
-- 
GitLab