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 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); + } +} 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']) {