Browse Source

add cache control for small images

master
filesite 4 months ago
parent
commit
fef3fe1802
  1. 5
      themes/beauty/controller/SiteController.php

5
themes/beauty/controller/SiteController.php

@ -281,8 +281,11 @@ Class SiteController extends Controller {
$imgType = preg_replace('/^data:(image\/.+);base64,.+$/i', "$1", $cachedData); $imgType = preg_replace('/^data:(image\/.+);base64,.+$/i', "$1", $cachedData);
$base64_img = preg_replace('/^data:image\/.+;base64,/i', '', $cachedData); $base64_img = preg_replace('/^data:image\/.+;base64,/i', '', $cachedData);
$img_data = base64_decode($base64_img);
header("Content-Type: {$imgType}"); header("Content-Type: {$imgType}");
echo base64_decode($base64_img); header('Cache-Control: max-age=86400');
header("Etag: " . md5($img_data));
echo $img_data;
exit; exit;
} }

Loading…
Cancel
Save