From ce99c4aa80d7211fb6b92a472c69ae34aac0ab67 Mon Sep 17 00:00:00 2001 From: nguyenanhung Date: Sun, 28 Apr 2024 20:17:18 +0700 Subject: [PATCH] Add mimes --- config/mimes.php | 2 ++ system/language/english/imglib_lang.php | 22 +++++++++++++--------- system/libraries/Image_lib.php | 4 ++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/config/mimes.php b/config/mimes.php index 2a59fcd..873c08f 100644 --- a/config/mimes.php +++ b/config/mimes.php @@ -161,6 +161,8 @@ 'tif' => 'image/tiff', 'heic' => 'image/heic', 'heif' => 'image/heif', + 'avif' => 'image/avif', + 'webp' => 'image/webp', 'css' => array('text/css', 'text/plain'), 'html' => array('text/html', 'text/plain'), 'htm' => array('text/html', 'text/plain'), diff --git a/system/language/english/imglib_lang.php b/system/language/english/imglib_lang.php index 01ac9d3..a3844b2 100644 --- a/system/language/english/imglib_lang.php +++ b/system/language/english/imglib_lang.php @@ -1,4 +1,5 @@ new_image)) + if ( ! preg_match('#\.(jpg|jpeg|gif|png|webp|avif)$#i', $this->new_image)) { $this->dest_image = $this->source_image; $this->dest_folder = $this->new_image; @@ -1237,7 +1237,7 @@ public function overlay_watermark() imagecopymerge($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height, $this->wm_opacity); } - // We can preserve transparency for PNG images + // We can preserve transparency for PNG, WEBP, AVIF images if ($this->image_type === 3) { imagealphablending($src_img, FALSE);