Lege Bildfassungen an und liefere sie zwischengespeichert aus (ADR-63)
CI Feature / test (push) Successful in 6m26s
Deploy Test / test (push) Successful in 5m14s
Deploy Test / deploy (push) Successful in 31s

Vorschaubilder entstehen zusätzlich als klein (360 px) und mittel (960 px),
Website-Bilder in den Breiten 640, 1280 und 1920. Auswahl, Listen und Karten
laden die kleinen Fassungen; die Website nutzt srcset. Adressen tragen Größe und
Version und werden dauerhaft zwischengespeichert (ETag, 304). Die Website-Route
läuft ohne Sitzung und Cookies. Bestand füllt sich über die Warteschlange oder
mit media:varianten. Die Optionsliste des CMS fragt nicht mehr je Eintrag ab.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-28 09:37:00 +01:00
1 parent 0492133201
commit 63b42b366c
54 files changed
+1033 -82

No files matched your search

+12 -14
View File
@@ -18,12 +18,14 @@
use App\Domain\Catalog\LicenseArticle;
use App\Domain\Catalog\OfferStatus;
use App\Domain\Cms\Catalog\PublicMaterialReader;
use App\Domain\Media\ThumbnailRef;
use App\Filament\Resources\Combinations\CombinationResource;
use App\Filament\Resources\ContentElements\ContentElementResource;
use App\Filament\Resources\Courses\CourseResource;
use App\Filament\Resources\Documents\DocumentResource;
use App\Filament\Resources\Exercises\ExerciseResource;
use App\Filament\Resources\Practices\PracticeResource;
use Carbon\CarbonInterface;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
@@ -115,7 +117,7 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
'usage_note' => (string) ($element->usage_note ?? ''),
'license_note' => (string) ($element->license_note ?? ''),
'tone' => $this->tone((string) $element->output_class, $kind),
'image' => $this->cardUrl('element', $element->id, $element->thumbnail_path),
'image' => $this->cardUrl('element', $element->id, $element->thumbnail_path, 'klein', $element->updated_at),
'version_label' => match ($version->status) {
ContentVersionStatus::Entwurf => 'Entwurf',
ContentVersionStatus::Gesperrt => 'deaktiviert',
@@ -163,7 +165,7 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
'kind' => $kind,
'summary' => FormattedText::plain((string) ($composition->summary ?? '')),
'tone' => $this->tone('', $kind),
'image' => $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path),
'image' => $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path, 'klein', $composition->updated_at),
'version_label' => $version->status === ContentVersionStatus::Gesperrt
? 'deaktiviert'
: 'Fassung '.$version->number,
@@ -198,7 +200,7 @@ private function draftCompositionRow(int $compositionId, int $exceptCompositionI
'kind' => $kind,
'summary' => FormattedText::plain((string) ($composition->summary ?? '')),
'tone' => $this->tone('', $kind),
'image' => $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path),
'image' => $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path, 'klein', $composition->updated_at),
'version_label' => 'Entwurf',
'identity' => 'zusammenstellung:'.$composition->id,
'open_url' => route('editorial.draft-preview', ['composition' => $composition]),
@@ -524,7 +526,7 @@ private function rowForPresentationMedium(int $id): ?array
'license_note' => (string) ($element->license_note ?? ''),
'tone' => $this->tone((string) $element->output_class, $kind),
'image' => $element->output_class === 'bild'
? $this->cardUrl('element', $element->id, $element->thumbnail_path)
? $this->cardUrl('element', $element->id, $element->thumbnail_path, 'klein', $element->updated_at)
: null,
'version_label' => 'Ohne Inhaltsfassung',
'committed' => false,
@@ -548,13 +550,9 @@ public function tone(string $outputClass, string $kindLabel): string
};
}
public function cardUrl(string $kind, int $id, ?string $path): ?string
public function cardUrl(string $kind, int $id, ?string $path, ?string $size = null, CarbonInterface|int|string|null $version = null): ?string
{
if (! is_string($path) || ! str_starts_with($path, 'vorschau/') || str_contains($path, '..')) {
return null;
}
return route('editorial.card', ['kind' => $kind, 'subject' => $id]);
return ThumbnailRef::url('editorial.card', $kind, $id, $path, $size, $version);
}
/**
@@ -891,7 +889,7 @@ public function filmPictures(array $members): array
continue;
}
$image = $this->cardUrl('element', $element->id, $element->thumbnail_path);
$image = $this->cardUrl('element', $element->id, $element->thumbnail_path, 'klein', $element->updated_at);
if ($image === null || isset($pictures[$element->id])) {
continue;
@@ -933,7 +931,7 @@ public function mediaPictures(string $query): array
->limit(12)
->get()
->map(function (ContentElement $element): ?array {
$image = $this->cardUrl('element', $element->id, $element->thumbnail_path);
$image = $this->cardUrl('element', $element->id, $element->thumbnail_path, 'klein', $element->updated_at);
if ($image === null) {
return null;
@@ -957,7 +955,7 @@ public function mediaPictures(string $query): array
*/
public function cover(Composition $composition, array $members): array
{
$own = $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path);
$own = $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path, 'mittel', $composition->updated_at);
if ($own !== null) {
return ['url' => $own, 'note' => null, 'own' => true];
@@ -970,7 +968,7 @@ public function cover(Composition $composition, array $members): array
}
return [
'url' => $this->cardUrl($picture['kind'], $picture['subject'], 'vorschau/gesetzt'),
'url' => $this->cardUrl($picture['kind'], $picture['subject'], 'vorschau/gesetzt', 'mittel'),
'note' => $picture['note'],
'own' => false,
];