Display CMS Optimierungen 29-05-2026

- Mediathek: Video-Vorschaubilder statt Icons (FFmpeg-Thumbnails + Backfill-Command), Kategorie "Sonstiges"
- B2in Media-Picker zeigt alle Medientypen, Typ wird automatisch erkannt; Thumbnail-Preview vor allen Medien-URL-Feldern
- B2in Marke/Footer: Footer ein/aus, Logo+Claim frei positionierbar (Ecken) mit Constraints, separate Anzeige-Schalter
- Angebote-Modul dynamisch: kein Slide-Typ mehr, einheitliches Detail-Layout mit ein-/ausblendbaren Bloecken, Logo/Brand pro Slide, Streichpreis-Option
- Player: leere Module stoppen Endlosschleife, dynamische Layout-Anpassung bei verstecktem Footer/Header
- Fix: Script-Ladereihenfolge (Livewire vor Flux), entfernte stale public/flux/flux.js, Modal-Crash beim Aktualisieren behoben

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin Adametz 2026-05-29 15:57:33 +00:00
parent 9262132325
commit 6c6d683b9a
42 changed files with 2267 additions and 13905 deletions

View file

@ -7,6 +7,7 @@ use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Symfony\Component\Process\Process;
class DisplayMediaService
{
@ -34,7 +35,7 @@ class DisplayMediaService
}
}
return DisplayMedia::create([
$media = DisplayMedia::create([
'filename' => $filename,
'disk' => 'public',
'path' => $relativePath,
@ -45,6 +46,80 @@ class DisplayMediaService
'collection' => $collection,
'metadata' => ! empty($metadata) ? $metadata : null,
]);
if ($type === 'video') {
$thumbnailPath = $this->generateVideoThumbnail($media);
if ($thumbnailPath !== null) {
$media->update(['thumbnail_path' => $thumbnailPath]);
}
}
return $media;
}
/**
* Generate a poster frame for an uploaded video using ffmpeg.
*
* Returns the relative thumbnail path on the media's disk, or null when
* generation is not possible (e.g. ffmpeg missing or an unreadable file).
*/
public function generateVideoThumbnail(DisplayMedia $media): ?string
{
if (! $media->isVideo() || ! $media->isUpload() || ! $media->path) {
return null;
}
$disk = Storage::disk($media->disk);
$videoPath = $disk->path($media->path);
if (! is_file($videoPath)) {
return null;
}
$thumbnailRelativePath = preg_replace('/\.[^.\/]+$/', '', $media->path).'-poster.jpg';
$thumbnailPath = $disk->path($thumbnailRelativePath);
if (! is_dir(dirname($thumbnailPath))) {
@mkdir(dirname($thumbnailPath), 0755, true);
}
// Try a frame ~1s in first (avoids black intro frames); fall back to
// the very first frame for clips shorter than one second.
foreach (['1', '0'] as $seekSeconds) {
if ($this->extractFrame($videoPath, $thumbnailPath, $seekSeconds) && filesize($thumbnailPath) > 0) {
return $thumbnailRelativePath;
}
}
if (is_file($thumbnailPath)) {
@unlink($thumbnailPath);
}
return null;
}
private function extractFrame(string $videoPath, string $thumbnailPath, string $seekSeconds): bool
{
$process = new Process([
'ffmpeg',
'-y',
'-ss', $seekSeconds,
'-i', $videoPath,
'-frames:v', '1',
'-vf', 'scale=640:-2',
'-q:v', '3',
$thumbnailPath,
]);
$process->setTimeout(60);
try {
$process->run();
} catch (\Throwable) {
return false;
}
return $process->isSuccessful() && is_file($thumbnailPath);
}
/**

View file

@ -143,25 +143,40 @@ class DisplayPlaylistConfigBuilder
*/
private function offersData(DisplayVersion $module, Collection $items): array
{
$slides = $items->where('item_type', 'slide')->values()->map(fn ($item) => [
'type' => $item->content['type'] ?? 'product-hero',
'duration' => $item->content['duration'] ?? 8000,
'image_url' => $item->content['image_url'] ?? '',
'badge_text' => $item->content['badge_text'] ?? '',
'eyebrow' => $item->content['eyebrow'] ?? '',
'title' => $item->content['title'] ?? '',
'subline' => $item->content['subline'] ?? '',
'price' => $item->content['price'] ?? '',
'original_price' => $item->content['original_price'] ?? '',
'tag_text' => $item->content['tag_text'] ?? '',
'bullets' => $item->content['bullets'] ?? [],
'disclaimer' => $item->content['disclaimer'] ?? '',
'qr_url' => $item->content['qr_url'] ?? '',
'qr_title' => $item->content['qr_title'] ?? '',
'contact' => $item->content['contact'] ?? '',
'show_brand_text' => $item->content['show_brand_text'] ?? false,
'brand_tagline' => $item->content['brand_tagline'] ?? '',
]);
$slides = $items->where('item_type', 'slide')->values()->map(function ($item) {
$content = $item->content;
return [
'type' => $content['type'] ?? 'detail',
'show_logo' => $content['show_logo'] ?? true,
'logo_url' => $content['logo_url'] ?? '',
'brand_text' => $content['brand_text'] ?? '',
'duration' => $content['duration'] ?? 8000,
'image_url' => $content['image_url'] ?? '',
'badge_text' => $content['badge_text'] ?? '',
'show_badge' => $content['show_badge'] ?? ($content['badge_text'] ?? '') !== '',
'eyebrow' => $content['eyebrow'] ?? '',
'show_eyebrow' => $content['show_eyebrow'] ?? ($content['eyebrow'] ?? '') !== '',
'title' => $content['title'] ?? '',
'subline' => $content['subline'] ?? '',
'show_subline' => $content['show_subline'] ?? ($content['subline'] ?? '') !== '',
'price' => $content['price'] ?? '',
'original_price' => $content['original_price'] ?? '',
'strike_original_price' => $content['strike_original_price'] ?? false,
'tag_text' => $content['tag_text'] ?? '',
'show_price' => $content['show_price'] ?? ($content['price'] ?? '') !== '',
'bullets' => $content['bullets'] ?? [],
'show_bullets' => $content['show_bullets'] ?? ! empty($content['bullets']),
'disclaimer' => $content['disclaimer'] ?? '',
'show_disclaimer' => $content['show_disclaimer'] ?? ($content['disclaimer'] ?? '') !== '',
'qr_url' => $content['qr_url'] ?? '',
'qr_title' => $content['qr_title'] ?? '',
'show_qr' => $content['show_qr'] ?? ($content['qr_url'] ?? '') !== '',
'contact' => $content['contact'] ?? '',
'show_contact' => $content['show_contact'] ?? ($content['contact'] ?? '') !== '',
'brand_tagline' => $content['brand_tagline'] ?? '',
];
});
return [
'type' => 'offers',