fix: guard missing logo files in request/final log PDF templates

This commit is contained in:
2026-05-14 15:58:21 +07:00
parent 4fea68e542
commit 46ac5c8651
6 changed files with 18 additions and 12 deletions

View File

@@ -216,8 +216,9 @@
<div class="triangle2"></div>
<div class="triangle1"></div>
@php
if(!empty($logoPerusahaan->path)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents(storage_path('app/public/' . $logoPerusahaan->path)));
$logoPath = !empty($logoPerusahaan->path) ? storage_path('app/public/' . $logoPerusahaan->path) : null;
if (!empty($logoPath) && is_file($logoPath)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents($logoPath));
echo '<img class="logo_company-' . now()->timestamp . '" src="' . $imgSrc . '">';
}
@endphp

View File

@@ -216,8 +216,9 @@
<div class="triangle2"></div>
<div class="triangle1"></div>
@php
if(!empty($logoPerusahaan->path)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents(storage_path('app/public/' . $logoPerusahaan->path)));
$logoPath = !empty($logoPerusahaan->path) ? storage_path('app/public/' . $logoPerusahaan->path) : null;
if (!empty($logoPath) && is_file($logoPath)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents($logoPath));
echo '<img class="logo_company-' . now()->timestamp . '" src="' . $imgSrc . '">';
}
@endphp

View File

@@ -210,8 +210,9 @@
<div class="triangle2"></div>
<div class="triangle1"></div>
@php
if(!empty($logoPerusahaan->path)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents(storage_path('app/public/' . $logoPerusahaan->path)));
$logoPath = !empty($logoPerusahaan->path) ? storage_path('app/public/' . $logoPerusahaan->path) : null;
if (!empty($logoPath) && is_file($logoPath)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents($logoPath));
echo '<img class="logo_company-' . now()->timestamp . '" src="' . $imgSrc . '">';
}
@endphp

View File

@@ -210,8 +210,9 @@
<div class="triangle2"></div>
<div class="triangle1"></div>
@php
if(!empty($logoPerusahaan->path)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents(storage_path('app/public/' . $logoPerusahaan->path)));
$logoPath = !empty($logoPerusahaan->path) ? storage_path('app/public/' . $logoPerusahaan->path) : null;
if (!empty($logoPath) && is_file($logoPath)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents($logoPath));
echo '<img class="logo_company-' . now()->timestamp . '" src="' . $imgSrc . '">';
}
@endphp

View File

@@ -224,8 +224,9 @@
<div class="triangle2"></div>
<div class="triangle1"></div>
@php
if(!empty($logoPerusahaan->path)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents(storage_path('app/public/' . $logoPerusahaan->path)));
$logoPath = !empty($logoPerusahaan->path) ? storage_path('app/public/' . $logoPerusahaan->path) : null;
if (!empty($logoPath) && is_file($logoPath)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents($logoPath));
echo '<img class="logo_company-' . now()->timestamp . '" src="' . $imgSrc . '">';
}
@endphp

View File

@@ -222,8 +222,9 @@
<div class="triangle2"></div>
<div class="triangle1"></div>
@php
if(!empty($logoPerusahaan->path)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents(storage_path('app/public/' . $logoPerusahaan->path)));
$logoPath = !empty($logoPerusahaan->path) ? storage_path('app/public/' . $logoPerusahaan->path) : null;
if (!empty($logoPath) && is_file($logoPath)) {
$imgSrc = 'data:image/png;base64,' . base64_encode(file_get_contents($logoPath));
echo '<img class="logo_company-' . now()->timestamp . '" src="' . $imgSrc . '">';
}
@endphp