From 77bec421d9e63b68a32eb204b750a5f0687743b5 Mon Sep 17 00:00:00 2001 From: Lorenzo Yario Date: Wed, 14 Feb 2024 01:18:45 -0800 Subject: [PATCH 1/3] webp --- inc/image.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/inc/image.php b/inc/image.php index d7756ffd..5f7fc8a5 100644 --- a/inc/image.php +++ b/inc/image.php @@ -496,3 +496,12 @@ class ImageBMP extends ImageBase { imagebmp($this->image, $src); } } + +class ImageWEBP extends ImageBase { + public function from() { + $this->image = @imagecreatefromwebp($this->src); + } + public function to($src) { + imagewebp($this->image, $src); + } +} From 23670bae4f763d81840039d19598dfb70ee0784e Mon Sep 17 00:00:00 2001 From: Lorenzo Yario Date: Wed, 14 Feb 2024 03:12:59 -0800 Subject: [PATCH 2/3] webp support by default --- inc/config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/config.php b/inc/config.php index da0fa3c1..0e255118 100644 --- a/inc/config.php +++ b/inc/config.php @@ -818,6 +818,7 @@ $config['allowed_ext'][] = 'bmp'; $config['allowed_ext'][] = 'gif'; $config['allowed_ext'][] = 'png'; + $config['allowed_ext'][] = 'webp'; // $config['allowed_ext'][] = 'svg'; // Allowed extensions for OP. Inherits from the above setting if set to false. Otherwise, it overrides both allowed_ext and From 2a0c495b59f8aadf2b7598ea2b243c7474b103f8 Mon Sep 17 00:00:00 2001 From: Lorenzo Yario Date: Wed, 14 Feb 2024 03:15:21 -0800 Subject: [PATCH 3/3] webp support --- post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post.php b/post.php index bd1591d9..248b372c 100644 --- a/post.php +++ b/post.php @@ -983,7 +983,7 @@ if (isset($_POST['delete'])) { if (!$size = @getimagesize($file['tmp_name'])) { error($config['error']['invalidimg']); } - if (!in_array($size[2], array(IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_BMP))) { + if (!in_array($size[2], array(IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_BMP, IMAGETYPE_WEBP))) { error($config['error']['invalidimg']); } if ($size[0] > $config['max_width'] || $size[1] > $config['max_height']) {