From f8fc6601ba029e984d339b877024201044aeabe7 Mon Sep 17 00:00:00 2001 From: filesite Date: Tue, 25 Oct 2022 17:46:07 +0800 Subject: [PATCH] add webp image type support --- conf/app.php | 5 +++-- lib/DirScanner.php | 7 +++++-- themes/googleimage/views/site/index.php | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/conf/app.php b/conf/app.php index 1fec5c9..1f72e60 100644 --- a/conf/app.php +++ b/conf/app.php @@ -30,19 +30,20 @@ $configs = array( 'debug' => true, //for themes - /* //图片皮肤配置 'googleimage' => array( 'imageHeight' => 350, //图片高度,单位:px 'contact' => 'FileSite图片网站订制联系:FileSite.io', + 'supportedImageExts' => array('jpg', 'jpeg', 'png', 'webp', 'gif'), ), - */ + /* //视频皮肤配置 'videoblog' => array( 'imageHeight' => 180, //图片高度,单位:px 'contact' => 'FileSite视频网站订制联系:FileSite.io', ), + */ //目前支持的皮肤 'allowedThemes' => array( diff --git a/lib/DirScanner.php b/lib/DirScanner.php index 3df339b..573a933 100644 --- a/lib/DirScanner.php +++ b/lib/DirScanner.php @@ -1,7 +1,6 @@ '完整路径', 'path' => '相对网址', 'extension' => '文件后缀', - 'fstat' => '资源状态', //同php方法fstat: https://www.php.net/manual/en/function.fstat.php + 'fstat' => '资源状态', //同php方法fstat: https://www.php.net/manual/en/function.fstat.php 'content' => 'MD文件内容', 'shortcut' => 'URL快捷方式', @@ -44,6 +43,7 @@ Class DirScanner { 'jpg', //图片 'jpeg', //图片 'png', //图片 + 'webp', //图片 'gif', //图片 'ico', //图标 'mp4', //视频 @@ -57,6 +57,7 @@ Class DirScanner { 'jpg' => 512000, //图片 'jpeg' => 512000, //图片 'png' => 512000, //图片 + 'webp' => 512000, //图片 'gif' => 512000, //图片 'ico' => 51200, //图标 'mp4' => 104857600, //视频 @@ -67,6 +68,7 @@ Class DirScanner { 'jpg', //图片 'jpeg', //图片 'png', //图片 + 'webp', //图片 'gif', //图片 'ico', //图标 'mp4', //视频 @@ -363,6 +365,7 @@ Class DirScanner { 'jpg' => "{$webRoot}{$directory}{$filename}.{$extension}", 'jpeg' => "{$webRoot}{$directory}{$filename}.{$extension}", 'png' => "{$webRoot}{$directory}{$filename}.{$extension}", + 'webp' => "{$webRoot}{$directory}{$filename}.{$extension}", 'gif' => "{$webRoot}{$directory}{$filename}.{$extension}", 'ico' => "{$webRoot}{$directory}{$filename}.{$extension}", 'mp4' => "{$webRoot}{$directory}{$filename}.{$extension}", diff --git a/themes/googleimage/views/site/index.php b/themes/googleimage/views/site/index.php index d7f8d5e..ce4126d 100644 --- a/themes/googleimage/views/site/index.php +++ b/themes/googleimage/views/site/index.php @@ -42,7 +42,7 @@ eof;