Upload via GUI (24 Dateien)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/** Liefert Vorschaubilder aus dem geschützten Speicher aus. */
|
||||
require_once __DIR__ . '/inc/lib.php';
|
||||
site_require_access();
|
||||
|
||||
$file = basename((string) ($_GET['file'] ?? ''));
|
||||
$path = site_storage() . '/previews/' . $file;
|
||||
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
$types = ['png' => 'image/png', 'jpg' => 'image/jpeg', 'webp' => 'image/webp'];
|
||||
if ($file === '' || !isset($types[$ext]) || !is_file($path)) { http_response_code(404); exit; }
|
||||
header('Content-Type: ' . $types[$ext]);
|
||||
header('Content-Length: ' . filesize($path));
|
||||
header('Cache-Control: public, max-age=86400');
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
readfile($path);
|
||||
Reference in New Issue
Block a user