attept 2 at site fix
This commit is contained in:
parent
60bcc67056
commit
cc7bbafb63
23 changed files with 360 additions and 75 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue