Fix: Bild-Uploads wieder funktionsfähig machen
- Upload-Limits auf 25 MB pro Bild bzw. 64 MB pro Request erhöht (public/.user.ini für FPM/CGI, docker/php/uploads.ini für Docker) - Docker: storage/-Verzeichnis beim Start auf www-data umstellen - Image::store() prüft Upload-Fehlercode, Bildformat, GD/JPEG und Schreibrechte und wirft verständliche Fehler statt still zu scheitern - Galerie, Benutzer- und Tour-Bild zeigen Fehler als Flash-Meldung - post_max_size-Überschreitung wird vor der CSRF-Prüfung abgefangen - Slug wandelt Großbuchstaben-Umlaute korrekt um - Diagnose-Script bin/check-upload.php ergänzt
This commit is contained in:
parent
8bde8d143e
commit
d8c9ec8ef8
16 changed files with 486 additions and 35 deletions
|
|
@ -178,15 +178,28 @@ class TourController
|
|||
redirect('/tour');
|
||||
}
|
||||
|
||||
// Bild wird in Image::store() inhaltlich geprüft (Format/Größe);
|
||||
// die dortige Fehlermeldung wird als Flash-Meldung angezeigt.
|
||||
validate([
|
||||
'tour_id' => 'required',
|
||||
'name' => 'required|min:3',
|
||||
'user_id' => 'required',
|
||||
'bild' => 'mimes:jpg,jpeg,bmp,png,gif',
|
||||
]);
|
||||
|
||||
$imageError = null;
|
||||
|
||||
if (!empty($_FILES['bild']['name'])) {
|
||||
Image::store($_FILES['bild'], 'tour_' . $tourId, (string) input('name'));
|
||||
try {
|
||||
Image::store($_FILES['bild'], 'tour_' . $tourId, (string) input('name'));
|
||||
} catch (\Throwable $e) {
|
||||
if (!$e instanceof \RuntimeException) {
|
||||
error_log('Tourbild-Upload: ' . $e);
|
||||
}
|
||||
|
||||
$imageError = $e instanceof \RuntimeException
|
||||
? $e->getMessage()
|
||||
: 'Das Bild konnte nicht verarbeitet werden.';
|
||||
}
|
||||
}
|
||||
|
||||
$tour->name = (string) input('name');
|
||||
|
|
@ -214,6 +227,11 @@ class TourController
|
|||
$tour->updated_at = now();
|
||||
$tour->save();
|
||||
|
||||
if ($imageError !== null) {
|
||||
flash_set('error', $imageError);
|
||||
redirect('/tour/' . $tourId . '/edit');
|
||||
}
|
||||
|
||||
redirect('/tour');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue