|
|
|
@ -185,6 +185,13 @@ Class SiteController extends Controller {
@@ -185,6 +185,13 @@ Class SiteController extends Controller {
|
|
|
|
|
$cacheSubDir = 'dir'; |
|
|
|
|
$cachedData = Common::getCacheFromFile($cacheKey, $expireSeconds, $cacheSubDir); |
|
|
|
|
|
|
|
|
|
//如果关闭缩略图 |
|
|
|
|
if (empty(FSC::$app['config']['enableSmallImage']) || FSC::$app['config']['enableSmallImage'] === 'false') { |
|
|
|
|
if (!empty($cachedData) && !empty($cachedData['size']) && $cachedData['size'] == 'small') { |
|
|
|
|
$cachedData = null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (empty($cachedData)) { |
|
|
|
|
//从缓存数据中获取目录的realpath |
|
|
|
|
$cachedData = Common::getCacheFromFile($cacheId); |
|
|
|
@ -218,8 +225,10 @@ Class SiteController extends Controller {
@@ -218,8 +225,10 @@ Class SiteController extends Controller {
|
|
|
|
|
}else { |
|
|
|
|
$url = $imgFile['path']; |
|
|
|
|
$img_id = $imgFile['id']; |
|
|
|
|
$size = 'orignal'; |
|
|
|
|
|
|
|
|
|
//小尺寸图片支持 |
|
|
|
|
if (!empty(FSC::$app['config']['enableSmallImage']) && FSC::$app['config']['enableSmallImage'] !== 'false') { |
|
|
|
|
$cacheKey_smimg = $this->getCacheKey($imgFile['id'], 'imgsm'); |
|
|
|
|
$expireSeconds = FSC::$app['config']['screenshot_expire_seconds']; //有效期3650天 |
|
|
|
|
$cacheSubDir = 'image'; |
|
|
|
@ -227,10 +236,12 @@ Class SiteController extends Controller {
@@ -227,10 +236,12 @@ Class SiteController extends Controller {
|
|
|
|
|
if (!empty($cachedData)) { |
|
|
|
|
$url = $cachedData; |
|
|
|
|
$img_id = ''; //无需再次生成小尺寸图片 |
|
|
|
|
$size = 'small'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$cacheSubDir = 'dir'; |
|
|
|
|
Common::saveCacheToFile($cacheKey, compact('url', 'img_id'), $cacheSubDir); |
|
|
|
|
Common::saveCacheToFile($cacheKey, compact('url', 'img_id', 'size'), $cacheSubDir); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
$code = 0; |
|
|
|
@ -259,7 +270,13 @@ Class SiteController extends Controller {
@@ -259,7 +270,13 @@ Class SiteController extends Controller {
|
|
|
|
|
$cacheKey = $this->getCacheKey($cateId, 'snap'); |
|
|
|
|
$img_id = ''; //为保持数据格式一致,图片id传空 |
|
|
|
|
$cacheSubDir = 'dir'; |
|
|
|
|
$saved = Common::saveCacheToFile($cacheKey, compact('url', 'img_id'), $cacheSubDir); |
|
|
|
|
|
|
|
|
|
$size = 'orignal'; |
|
|
|
|
if (!empty(FSC::$app['config']['enableSmallImage']) && FSC::$app['config']['enableSmallImage'] !== 'false') { |
|
|
|
|
$size = 'small'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$saved = Common::saveCacheToFile($cacheKey, compact('url', 'img_id', 'size'), $cacheSubDir); |
|
|
|
|
|
|
|
|
|
if ($saved !== false) { |
|
|
|
|
$code = 1; |
|
|
|
@ -314,7 +331,8 @@ Class SiteController extends Controller {
@@ -314,7 +331,8 @@ Class SiteController extends Controller {
|
|
|
|
|
$cacheKey = $this->getCacheKey($cateId, 'snap'); |
|
|
|
|
$img_id = ''; //为保持数据格式一致,图片id传空 |
|
|
|
|
$cacheSubDir = 'dir'; |
|
|
|
|
Common::saveCacheToFile($cacheKey, array('url' => $imgData, 'img_id' => $img_id), $cacheSubDir); |
|
|
|
|
$size = 'small'; |
|
|
|
|
Common::saveCacheToFile($cacheKey, array('url' => $imgData, 'img_id' => $img_id, 'size' => $size), $cacheSubDir); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$cacheKey = $this->getCacheKey($imgId, 'imgsm'); |
|
|
|
|