Browse Source

docker file upgrade php from 8.1 to 8.4, alphine from 3.16 to 3.20

master
filesite 1 month ago
parent
commit
efc97d5998
  1. 2
      Dockerfile
  2. 5
      themes/beauty/controller/SiteController.php

2
Dockerfile

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
FROM php:8.1.12RC1-fpm-alpine3.16
FROM php:8.4.0RC2-zts-alpine3.20
RUN apk add rsync nginx zlib-dev libpng-dev freetype-dev libjpeg-turbo-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd \

5
themes/beauty/controller/SiteController.php

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

Loading…
Cancel
Save