Fix: Tour-Titelbild wird gespeichert und angezeigt

This commit is contained in:
torsten 2026-11-08 16:51:23 +01:00
parent 3570f6a8ed
commit ae7bab1c95
6 changed files with 77 additions and 8 deletions

View file

@ -83,6 +83,21 @@ class TourController
'updated_at' => now(),
]);
if (!empty($_FILES['bild']['name'])) {
try {
Image::storePublic($_FILES['bild'], 'img/tour', (string) $tour->id);
} catch (\Throwable $e) {
if (!$e instanceof \RuntimeException) {
error_log('Tourbild-Upload: ' . $e);
}
flash_set('error', $e instanceof \RuntimeException
? $e->getMessage()
: 'Das Bild konnte nicht verarbeitet werden.');
redirect('/tour/' . $tour->id . '/edit');
}
}
redirect('/tour');
}
@ -190,7 +205,8 @@ class TourController
if (!empty($_FILES['bild']['name'])) {
try {
Image::store($_FILES['bild'], 'tour_' . $tourId, (string) input('name'));
// Tour-Titelbilder liegen wie bisher unter public/img/tour/<id>.jpg
Image::storePublic($_FILES['bild'], 'img/tour', (string) $tourId);
} catch (\Throwable $e) {
if (!$e instanceof \RuntimeException) {
error_log('Tourbild-Upload: ' . $e);