|
|
|
@ -317,6 +317,24 @@ Class SiteController extends Controller {
@@ -317,6 +317,24 @@ Class SiteController extends Controller {
|
|
|
|
|
//当前目录有缩略图的时候才缓存 |
|
|
|
|
$cacheSubDir = 'dir'; |
|
|
|
|
Common::saveCacheToFile($cacheKey, compact('url', 'size'), $cacheSubDir); |
|
|
|
|
}else { |
|
|
|
|
//实时生成缩略图 |
|
|
|
|
$img_filepath = $imgFile['realpath']; |
|
|
|
|
$img_data = $this->createSmallJpg($img_filepath); |
|
|
|
|
if (!empty($img_data)) { |
|
|
|
|
//保存到缓存文件 |
|
|
|
|
$cacheKey_smimg = $this->getCacheKey($imgFile['id'], 'imgsm'); |
|
|
|
|
$cacheSubDir = 'image'; |
|
|
|
|
$base64_img = base64_encode($img_data); |
|
|
|
|
Common::saveCacheToFile($cacheKey_smimg, "data:image/jpeg;base64,{$base64_img}", $cacheSubDir); |
|
|
|
|
|
|
|
|
|
$url = "data:image/jpeg;base64,{$base64_img}"; |
|
|
|
|
$size = 'small'; |
|
|
|
|
|
|
|
|
|
//缓存目录封面图 |
|
|
|
|
$cacheSubDir = 'dir'; |
|
|
|
|
Common::saveCacheToFile($cacheKey, compact('url', 'size'), $cacheSubDir); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else if (empty(FSC::$app['config']['enableSmallImage']) || FSC::$app['config']['enableSmallImage'] === 'false') { |
|
|
|
|
//如果关闭了缩略图功能则缓存原图 |
|
|
|
|