!empty($v['key']))); if ($varianten === []) { return; } $anchor = $anchor ?? 'varianten'; $text = trim((string) ($text ?? '')); $titleHidden = !empty($title_hidden); $paket = $paket ?? []; $tinted = !empty($tinted); $dir = PUBLIC_PATH . '/assets/downloads/logo'; /** Dateigröße menschenlesbar: unter 1 MB in KB, darüber mit einer Nachkommastelle in MB. */ $size = static function (string $file): string { $bytes = (int) filesize($file); return $bytes < 1024 * 1024 ? number_format($bytes / 1024, 0, ',', '.') . ' KB' : number_format($bytes / 1024 / 1024, 1, ',', '.') . ' MB'; }; // Reihenfolge der Knöpfe = Reihenfolge der Empfehlung: erst Vektor (das Richtige für // die Druckerei), dann PNG (freigestellt), zuletzt JPG (mit gefülltem Rechteck drumherum). $formate = static function (string $base) use ($dir): array { $liste = []; foreach ([ ['datei' => "{$base}.svg", 'label' => 'SVG', 'hint' => 'Vektor'], ['datei' => "{$base}.pdf", 'label' => 'PDF', 'hint' => 'Vektor'], ['datei' => "{$base}-500.png", 'label' => 'PNG', 'hint' => '500 px'], ['datei' => "{$base}-1000.png", 'label' => 'PNG', 'hint' => '1000 px'], ['datei' => "{$base}-2000.png", 'label' => 'PNG', 'hint' => '2000 px'], ['datei' => "{$base}-1000.jpg", 'label' => 'JPG', 'hint' => '1000 px'], ['datei' => "{$base}-2000.jpg", 'label' => 'JPG', 'hint' => '2000 px'], ] as $format) { if (is_file($dir . '/' . $format['datei'])) { $liste[] = $format; } } return $liste; }; ?>
>