implemented tag and last-modified for images. closes #119

This commit is contained in:
Chris
2020-06-03 00:38:05 +02:00
parent 984246912c
commit ceffa04b6e

View File

@@ -192,21 +192,29 @@ class ImageController implements ContentController
case 'jpeg': case 'jpeg':
case 'jpg': case 'jpg':
header ("Content-type: image/jpeg"); header ("Content-type: image/jpeg");
header ("Last-Modified: ".gmdate('D, d M Y H:i:s ', filemtime($path)) . 'GMT');
header ("ETag: $hash");
readfile($path); readfile($path);
break; break;
case 'png': case 'png':
header ("Content-type: image/png"); header ("Content-type: image/png");
header ("Last-Modified: ".gmdate('D, d M Y H:i:s ', filemtime($path)) . 'GMT');
header ("ETag: $hash");
readfile($path); readfile($path);
break; break;
case 'gif': case 'gif':
header ("Content-type: image/gif"); header ("Content-type: image/gif");
header ("Last-Modified: ".gmdate('D, d M Y H:i:s ', filemtime($path)) . 'GMT');
header ("ETag: $hash");
readfile($path); readfile($path);
break; break;
case 'webp': case 'webp':
header ("Content-type: image/webp"); header ("Content-type: image/webp");
header ("Last-Modified: ".gmdate('D, d M Y H:i:s ', filemtime($path)) . 'GMT');
header ("ETag: $hash");
readfile($path); readfile($path);
break; break;
} }