Erlaube in PDF-Vorlagen jedes Bild des Medienmanagers, auch ohne Inhaltsfassung
Kopf-, Fuß- und Titelbild einer PDF-Vorlage sind Gestaltung und brauchen keine Inhaltsfassung. Der Picker bietet auch Präsentationsmedien und für die Website freigegebene Bilder an (Spalten *_element_id, Klasse TemplateImage); gedruckt wird die Website-Datei, sonst die Präsentationsdatei. Abgelehnt werden nur gesperrte oder archivierte Bilder, fehlende Dateien und Nicht-Bilder. Bilder im Text eines Dokuments bleiben an freigegebene Bildfassungen gebunden. Die öffentliche Eigenschaft heißt bilder, weil slots mit Livewires internem Slot-Mechanismus kollidiert. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
765b8e779e
commit
58b68b768c
13 files changed
+369
-85
No files matched your search
@@ -5,7 +5,6 @@
|
||||
use App\Domain\Commerce\Receipt\PdfDocument;
|
||||
use App\Domain\Media\PdfImage;
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Transliterator;
|
||||
|
||||
/**
|
||||
@@ -88,9 +87,9 @@ public function render(array $guide, string $licensee, string $copyId, ?PdfImage
|
||||
private function prepareLayout(?PdfTemplate $template): void
|
||||
{
|
||||
$this->bands = [
|
||||
'header' => $this->band($template?->headerVersion, 140.0),
|
||||
'footer' => $this->band($template?->footerVersion, 140.0),
|
||||
'cover' => $template !== null && $template->show_cover ? $this->band($template->coverVersion, self::PAGE_HEIGHT * 0.4) : null,
|
||||
'header' => $this->band($template?->target('header'), 140.0),
|
||||
'footer' => $this->band($template?->target('footer'), 140.0),
|
||||
'cover' => $template !== null && $template->show_cover ? $this->band($template->target('cover'), self::PAGE_HEIGHT * 0.4) : null,
|
||||
];
|
||||
$header = (float) ($this->bands['header']['height'] ?? 0);
|
||||
$footer = (float) ($this->bands['footer']['height'] ?? 0);
|
||||
@@ -104,10 +103,10 @@ private function prepareLayout(?PdfTemplate $template): void
|
||||
*
|
||||
* @return array{jpeg: string, pixelWidth: int, pixelHeight: int, width: float, height: float, x: float}|null
|
||||
*/
|
||||
private function band(?ContentElementVersion $version, float $maxHeight): ?array
|
||||
private function band(?string $target, float $maxHeight): ?array
|
||||
{
|
||||
$file = $version === null ? null : EmbeddedImages::file($version);
|
||||
$image = $file === null ? null : PdfImage::fromBytes((string) Storage::disk('media_derived')->get($file));
|
||||
$bytes = TemplateImage::bytes($target);
|
||||
$image = $bytes === null ? null : PdfImage::fromBytes($bytes);
|
||||
|
||||
if ($image === null) {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user