Merge pull request #224 from zhendery/svg-preivew

feat: 添加svg矢量图,主要是广场预览
master
icret 2025-01-14 02:02:53 +08:00 committed by GitHub
commit 1935009daa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -1036,10 +1036,11 @@ function creat_thumbnail_by_list($imgUrl)
global $config; global $config;
ini_set('max_execution_time', '300'); // 脚本运行的时间以秒为单位0不限制 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'))) { if (!in_array($extension, array('png', 'gif', 'jpeg', 'jpg', 'webp', 'bmp'))) {
// ico格式直接返回直链 // ico和svg格式直接返回直链
if (pathinfo($imgUrl, PATHINFO_EXTENSION) === 'ico') return $imgUrl; if ($extension === 'ico' || $extension === 'svg') return $imgUrl;
// 其他格式直接返回指定图标 // 其他格式直接返回指定图标
return '../public/images/file.svg'; return '../public/images/file.svg';
} }

View File

@ -41,7 +41,7 @@ $config=Array
'textSize'=>20, 'textSize'=>20,
'textFont'=>'/public/static/pang_men_zheng_dao_biao_ti_ti_3.0.ttf', 'textFont'=>'/public/static/pang_men_zheng_dao_biao_ti_ti_3.0.ttf',
'waterImg'=>'/public/images/watermark.png', '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'=>0,
'compress_ratio'=>80, 'compress_ratio'=>80,
'thumbnail'=>1, 'thumbnail'=>1,