Mediathek: zentrale Bildverwaltung mit Verwendungsnachweis und Bildauswahl
- Tabellen media und media_usages, Modelle Media/MediaUsage - App\Media\MediaLibrary (store/register/replace/delete/rebuild) und Registry App\Media\MediaUsages (Quellen: Seiten, Neuigkeiten inkl. künftiger content-Spalte, Termine, Startseiten-Kacheln), ImagePaths-Extraktor - Alle Uploads landen in der Mediathek (Seiten-Editor direkt, übrige über Beobachter beim Speichern); Daten-Migration und media:rebuild übernehmen bestehende Bilder - Recht media.manage, Zugang media.use für alle Redaktionsbereiche - /redaktion/mediathek (Suche, Filter, Upload mit Fortschritt, Details, Eingebunden in, Ersetzen, Löschen mit Warnung, Mehrfachauswahl), Abschnitt in der Redaktion und Menüpunkt im Admin-Bereich - MediaPicker (Hochladen/Mediathek) im Pagebuilder: Bildfelder und Galerie (Mehrfachauswahl), editor.pickMedia im provide-API - Bild-URLs mit ?v=Änderungszeit, null bei fehlender Datei; Modelle löschen geteilte Bilder nicht mehr selbst Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3b72b5327e
commit
694ccf6ae0
46 changed files with 3101 additions and 89 deletions
|
|
@ -5,7 +5,7 @@ namespace App\Pagebuilder;
|
|||
use App\Http\Resources\PersonResource;
|
||||
use App\Models\User;
|
||||
use App\Plugins\Hooks;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Support\Images;
|
||||
|
||||
/**
|
||||
* Registry der Pagebuilder-Blöcke. Der Kern bringt Layout- und Inhaltsblöcke
|
||||
|
|
@ -66,9 +66,13 @@ class Blocks
|
|||
return array_values(array_map(fn (BlockType $type) => $type->toArray(), $this->all()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adresse eines Bilds – null, wenn die Datei fehlt (z. B. in der Mediathek
|
||||
* gelöscht): Der Block zeigt dann seinen Platzhalter.
|
||||
*/
|
||||
public static function imageUrl(?string $path): ?string
|
||||
{
|
||||
return $path ? Storage::disk('uploads')->url($path) : null;
|
||||
return app(Images::class)->url($path, null);
|
||||
}
|
||||
|
||||
private function registerLayout(): void
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Pagebuilder;
|
||||
|
||||
use App\Media\ImagePaths;
|
||||
use App\Models\User;
|
||||
use App\Plugins\PluginAccess;
|
||||
use App\Support\Permissions\Audiences;
|
||||
|
|
@ -138,7 +139,7 @@ class Content
|
|||
$texts = [];
|
||||
|
||||
array_walk_recursive($block['data'], function ($value) use (&$texts) {
|
||||
if (is_string($value) && ! str_starts_with($value, 'pagebuilder/')) {
|
||||
if (is_string($value) && ! ImagePaths::isCandidate($value)) {
|
||||
$texts[] = strip_tags($value);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Pagebuilder;
|
||||
|
||||
use App\Media\ImagePaths;
|
||||
use App\Support\Icons;
|
||||
use App\Support\RichText;
|
||||
use Closure;
|
||||
|
|
@ -62,7 +63,7 @@ final class Field
|
|||
return new self($name, 'url', $label, ['default' => $default]);
|
||||
}
|
||||
|
||||
/** Hochgeladenes Bild (Pfad im Upload-Speicher). */
|
||||
/** Hochgeladenes Bild bzw. Bild aus der Mediathek (Pfad im Upload-Speicher). */
|
||||
public static function image(string $name, string $label): self
|
||||
{
|
||||
return new self($name, 'image', $label, ['default' => null]);
|
||||
|
|
@ -140,7 +141,7 @@ final class Field
|
|||
'toggle' => (bool) $value,
|
||||
'number' => max($this->options['min'], min($this->options['max'], is_numeric($value) ? (int) $value : $this->options['default'])),
|
||||
'url' => self::safeUrl($value),
|
||||
'image' => is_string($value) && preg_match('#^pagebuilder/[A-Za-z0-9/_.-]+$#', $value) && ! str_contains($value, '..') ? $value : null,
|
||||
'image' => ImagePaths::isCandidate($value) ? $value : null,
|
||||
'people', 'ids' => array_values(array_slice(array_unique(array_filter(array_map('intval', is_array($value) ? $value : []))), 0, $this->options['max'])),
|
||||
'table' => $this->sanitizeTable($value),
|
||||
'icon' => Icons::has($value) ? $value : $this->options['default'],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue