attept 2 at site fix

This commit is contained in:
Frank Harris 2026-06-17 17:36:25 -05:00
parent 60bcc67056
commit cc7bbafb63
23 changed files with 360 additions and 75 deletions

View file

@ -18,14 +18,15 @@ if ($assetPath === null || !is_readable($assetPath)) {
exit;
}
$mimeType = match (strtolower(pathinfo($assetPath, PATHINFO_EXTENSION))) {
$extension = strtolower(pathinfo($assetPath, PATHINFO_EXTENSION));
$mimeTypes = [
'png' => 'image/png',
'jpg', 'jpeg' => 'image/jpeg',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'webp' => 'image/webp',
default => 'application/octet-stream',
};
];
$mimeType = $mimeTypes[$extension] ?? 'application/octet-stream';
header('Content-Type: ' . $mimeType);
header('Content-Length: ' . (string)filesize($assetPath));
readfile($assetPath);