Biete Tabellen und Bilder im gemeinsamen Texteditor an und setze sie in Ansicht und PDF

Tabellen und Bilder gehören zur festen Auswahl von FormattedText. Ein Bild
ist ein Verweis auf eine freigegebene Bildfassung und kommt per Picker aus
dem Medienbestand; der Stand schreibt die Bildfassung mit fest, die Rechte
entscheidet DecideAccess. Der PDF-Satz (PdfFlow) ist für Übung und kommende
Dokumente gemeinsam; PdfDocument kann zusätzlich Bilder, Flächen, Verweise
und Lesezeichen, Belege bleiben byte-gleich.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-24 11:31:03 +01:00
1 parent 219962daff
commit c57a506f85
27 files changed
+1729 -219

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
<?php
namespace App\Domain\Catalog;
use App\Domain\Entitlement\Grant;
use Closure;
/**
* Die Bilder eines PDF: löst jedes Bild einmal auf und merkt sich, welche Bildfassungen tatsächlich gedruckt wurden,
* damit der Ausgabenachweis sie wie jede andere Fassung des PDF führt.
*/
final class PdfImages
{
/** @var array<int, array{jpeg?: string, width?: int, height?: int, note?: string, grant: ?Grant, version: ?ContentElementVersion}|null> */
private array $resolved = [];
/**
* @param Closure(int): ?array{jpeg?: string, width?: int, height?: int, note?: string, grant: ?Grant, version: ?ContentElementVersion} $resolve
*/
public function __construct(private readonly Closure $resolve) {}
/**
* @return array{jpeg?: string, width?: int, height?: int, note?: string}|null
*/
public function __invoke(int $id): ?array
{
if (! array_key_exists($id, $this->resolved)) {
$this->resolved[$id] = ($this->resolve)($id);
}
return $this->resolved[$id];
}
/**
* @return list<array{version: ContentElementVersion, grant: Grant}>
*/
public function used(): array
{
$used = [];
foreach ($this->resolved as $found) {
if ($found !== null && isset($found['jpeg']) && $found['version'] instanceof ContentElementVersion && $found['grant'] instanceof Grant) {
$used[] = ['version' => $found['version'], 'grant' => $found['grant']];
}
}
return $used;
}
}