|
|
@ -618,6 +618,7 @@ Class SiteController extends Controller { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//无缓存,则实时生成缩略图 |
|
|
|
//无缓存,则实时生成缩略图 |
|
|
|
|
|
|
|
$minCacheImgSize = 2 * 1024; //最小图片尺寸:20Kb |
|
|
|
if (empty($cachedData)) { |
|
|
|
if (empty($cachedData)) { |
|
|
|
$tmpUrl = parse_url($imgUrl); |
|
|
|
$tmpUrl = parse_url($imgUrl); |
|
|
|
$img_filepath = __DIR__ . '/../../../www' . $tmpUrl['path']; |
|
|
|
$img_filepath = __DIR__ . '/../../../www' . $tmpUrl['path']; |
|
|
@ -631,8 +632,10 @@ Class SiteController extends Controller { |
|
|
|
|
|
|
|
|
|
|
|
//返回图片数据 |
|
|
|
//返回图片数据 |
|
|
|
header("Content-Type: image/jpeg"); |
|
|
|
header("Content-Type: image/jpeg"); |
|
|
|
header("Cache-Control: max-age={$small_image_client_cache_seconds}"); |
|
|
|
if (strlen($img_data) >= $minCacheImgSize) { |
|
|
|
header("Etag: " . md5($img_data)); |
|
|
|
header("Cache-Control: max-age={$small_image_client_cache_seconds}"); |
|
|
|
|
|
|
|
header("Etag: " . md5($img_data)); |
|
|
|
|
|
|
|
} |
|
|
|
echo $img_data; |
|
|
|
echo $img_data; |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
@ -648,8 +651,10 @@ Class SiteController extends Controller { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
header("Content-Type: {$imgType}"); |
|
|
|
header("Content-Type: {$imgType}"); |
|
|
|
header("Cache-Control: max-age={$small_image_client_cache_seconds}"); |
|
|
|
if (strlen($img_data) >= $minCacheImgSize) { |
|
|
|
header("Etag: {$etag}"); |
|
|
|
header("Cache-Control: max-age={$small_image_client_cache_seconds}"); |
|
|
|
|
|
|
|
header("Etag: {$etag}"); |
|
|
|
|
|
|
|
} |
|
|
|
echo $img_data; |
|
|
|
echo $img_data; |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|