From f1a55efbda3c511b6e4e42dcd396fa1d54b719fe Mon Sep 17 00:00:00 2001 From: zhendery Date: Tue, 24 Dec 2024 13:09:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0svg=E7=9F=A2=E9=87=8F?= =?UTF-8?q?=E5=9B=BE=EF=BC=8C=E4=B8=BB=E8=A6=81=E6=98=AF=E5=B9=BF=E5=9C=BA?= =?UTF-8?q?=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/function.php | 7 ++++--- config/config.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/function.php b/app/function.php index b7615cfd..08ef5c51 100644 --- a/app/function.php +++ b/app/function.php @@ -1036,10 +1036,11 @@ function creat_thumbnail_by_list($imgUrl) global $config; ini_set('max_execution_time', '300'); // 脚本运行的时间(以秒为单位)0不限制 + $extension = pathinfo($imgUrl, PATHINFO_EXTENSION); // 过滤非指定格式 - if (!in_array(pathinfo($imgUrl, PATHINFO_EXTENSION), array('png', 'gif', 'jpeg', 'jpg', 'webp', 'bmp'))) { - // ico格式直接返回直链 - if (pathinfo($imgUrl, PATHINFO_EXTENSION) === 'ico') return $imgUrl; + if (!in_array($extension, array('png', 'gif', 'jpeg', 'jpg', 'webp', 'bmp'))) { + // ico和svg格式直接返回直链 + if ($extension === 'ico' || $extension === 'svg') return $imgUrl; // 其他格式直接返回指定图标 return '../public/images/file.svg'; } diff --git a/config/config.php b/config/config.php index e5ecabcb..817d5885 100755 --- a/config/config.php +++ b/config/config.php @@ -41,7 +41,7 @@ 'textSize'=>20, 'textFont'=>'/public/static/pang_men_zheng_dao_biao_ti_ti_3.0.ttf', 'waterImg'=>'/public/images/watermark.png', - 'extensions'=>'jpg,jpeg,png,gif,bmp,webp,ico,jfif,tif,tga', + 'extensions'=>'jpg,jpeg,png,gif,bmp,webp,ico,jfif,tif,tga,svg', 'compress'=>0, 'compress_ratio'=>80, 'thumbnail'=>1,