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. 13
      themes/beauty/controller/SiteController.php

2
Dockerfile

@ -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 \ 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-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd \ && docker-php-ext-install -j$(nproc) gd \

13
themes/beauty/controller/SiteController.php

@ -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;
} }

Loading…
Cancel
Save