Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 添加svg矢量图,主要是广场预览 #224

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/function.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
2 changes: 1 addition & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading