fix(documents): Logo auch im Hosting-Layout finden (Assets ohne web/-Ordner)
Auf dem Server ist der Inhalt von web/ der DocumentRoot; DIC_ROOT . '/web/assets/...' existiert dort nicht. document_logo_path() prüft jetzt beide Varianten (web/assets/img/... und assets/img/...) und protokolliert, wenn keine gefunden wird.
This commit is contained in:
parent
a755e7af81
commit
7f1b477f33
1 changed files with 14 additions and 2 deletions
|
|
@ -298,14 +298,26 @@ function document_pdf_footer(PdfDoc $pdf, string $label): void
|
|||
$pdf->text(50, $h - 38, 7.5, 'Seite ' . $pdf->pageNo(), false, 'right', $w - 100);
|
||||
}
|
||||
|
||||
/** Logo-Datei für die PDF-Kopfzeile (PNG mit Transparenz) oder null. */
|
||||
/**
|
||||
* Logo-Datei für die PDF-Kopfzeile (PNG mit Transparenz) oder null.
|
||||
*
|
||||
* Im Repository liegen die Assets unter web/assets/…, auf dem Hosting ist der
|
||||
* Inhalt von web/ der DocumentRoot – deshalb beide Pfade prüfen.
|
||||
*/
|
||||
function document_logo_path(): ?string
|
||||
{
|
||||
foreach (['/web/assets/img/logo-drink-it-cold-480.png', '/web/assets/img/logo-drink-it-cold.png'] as $candidate) {
|
||||
$candidates = [
|
||||
'/web/assets/img/logo-drink-it-cold-480.png',
|
||||
'/assets/img/logo-drink-it-cold-480.png',
|
||||
'/web/assets/img/logo-drink-it-cold.png',
|
||||
'/assets/img/logo-drink-it-cold.png',
|
||||
];
|
||||
foreach ($candidates as $candidate) {
|
||||
if (is_file(DIC_ROOT . $candidate)) {
|
||||
return DIC_ROOT . $candidate;
|
||||
}
|
||||
}
|
||||
error_log('Dokument: Logo fehlt (gesucht in ' . implode(', ', $candidates) . ' unter ' . DIC_ROOT . ').');
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue