diff --git a/conf/app.php b/conf/app.php
index 774008a..b63c895 100644
--- a/conf/app.php
+++ b/conf/app.php
@@ -53,6 +53,7 @@ $configs = array(
'supportedVideoExts' => array('mp4', 'mov', 'm3u8'),
'screenshot_start' => 1000, //视频播放页快照截取开始时间,单位:毫秒
'screenshot_expire_seconds' => 315360000, //视频封面图缓存3650天
+ 'enableSmallImage' => true, //开启图片小尺寸缩略图
/*
//视频皮肤配置
diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php
index 9ab31a5..5b4a2a8 100644
--- a/themes/beauty/controller/SiteController.php
+++ b/themes/beauty/controller/SiteController.php
@@ -266,6 +266,7 @@ Class SiteController extends Controller {
}
//优先从缓存获取小尺寸的图片
+ //增加父目录封面图缓存更新
public function actionSmallimg() {
$imgId = $this->get('id', '');
$imgUrl = $this->get('url', '');
@@ -297,12 +298,20 @@ Class SiteController extends Controller {
$code = 0;
$msg = 'OK';
+ $cateId = $this->post('pid', '');
$imgId = $this->post('id', '');
$imgData = $this->post('data', ''); //base64格式的图片数据
if (empty($imgId) || empty($imgData)) {
$code = 0;
$msg = '参数不能为空';
}else {
+ //如果是目录封面图生成缩略图,则更新目录封面图缓存数据
+ if (!empty($cateId)) {
+ $cacheKey = $this->getCacheKey($cateId, 'dirsnap');
+ $img_id = ''; //为保持数据格式一致,图片id传空
+ Common::saveCacheToFile($cacheKey, array('url' => $imgData, 'img_id' => $img_id));
+ }
+
$cacheKey = $this->getCacheKey($imgId, 'imgsm');
$cacheSubDir = 'image';
$saved = Common::saveCacheToFile($cacheKey, $imgData, $cacheSubDir);
diff --git a/themes/beauty/views/layout/main.php b/themes/beauty/views/layout/main.php
index 1ea65bc..95c8f1c 100644
--- a/themes/beauty/views/layout/main.php
+++ b/themes/beauty/views/layout/main.php
@@ -101,6 +101,13 @@ require_once __DIR__ . '/../../../../plugins/Html.php';
+