From 1b1c89867e0eb8e090a16b9ca3ee817cadbc73a9 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 29 Apr 2026 21:50:12 +0200 Subject: [PATCH] Fixes #2036 WebP support when using PHP GD --- admin/include/image.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/admin/include/image.class.php b/admin/include/image.class.php index 67718acf2..e583185e0 100644 --- a/admin/include/image.class.php +++ b/admin/include/image.class.php @@ -786,6 +786,10 @@ class image_gd implements imageInterface { $this->image = imagecreatefromgif($source_filepath); } + elseif ($extension == 'webp' and $gd_info['WebP Support']) + { + $this->image = imagecreatefromwebp($source_filepath); + } else { die('[Image GD] unsupported file extension'); @@ -911,6 +915,10 @@ class image_gd implements imageInterface { imagegif($this->image, $destination_filepath); } + elseif ($extension == 'webp') + { + imagewebp($this->image, $destination_filepath, $this->quality); + } else { imagejpeg($this->image, $destination_filepath, $this->quality);