diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php index ce8dfb0..1b44fec 100644 --- a/themes/beauty/controller/SiteController.php +++ b/themes/beauty/controller/SiteController.php @@ -213,6 +213,16 @@ Class SiteController extends Controller { } }else { $url = $imgFile['path']; + + //小尺寸图片支持 + $cacheKey = $this->getCacheKey($imgFile['id'], 'imgsm'); + $expireSeconds = FSC::$app['config']['screenshot_expire_seconds']; //有效期3650天 + $cacheSubDir = 'image'; + $cachedData = Common::getCacheFromFile($cacheKey, $expireSeconds, $cacheSubDir); + if (!empty($cachedData)) { + $url = $cachedData; + } + Common::saveCacheToFile($cacheKey, $url); } }else { diff --git a/themes/beauty/views/site/index.php b/themes/beauty/views/site/index.php index 08cb707..6b264c9 100644 --- a/themes/beauty/views/site/index.php +++ b/themes/beauty/views/site/index.php @@ -177,15 +177,15 @@ eof; } if (in_array($first_img['extension'], $imgExts)) { - if ($index > 0) { - echo << -eof; - } else { - echo << + $imgUrl = urlencode($first_img['path']); + $smallUrl = "/site/smallimg/?id={$first_img['id']}&url={$imgUrl}"; + echo << eof; - } } else { echo <<