From 46ac5c86510575494d226d2afab7935966bbe2d6 Mon Sep 17 00:00:00 2001 From: Tubagus Fajri Date: Thu, 14 May 2026 15:58:21 +0700 Subject: [PATCH] fix: guard missing logo files in request/final log PDF templates --- resources/views/pdf/final_log_page_1.blade.php | 5 +++-- resources/views/pdf/final_log_page_1_primayan.blade.php | 5 +++-- resources/views/pdf/final_log_page_2.blade.php | 5 +++-- resources/views/pdf/final_log_page_2_primayan.blade.php | 5 +++-- resources/views/pdf/req_log_page_1.blade.php | 5 +++-- resources/views/pdf/req_log_page_1_primayan.blade.php | 5 +++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/resources/views/pdf/final_log_page_1.blade.php b/resources/views/pdf/final_log_page_1.blade.php index 486b4e2e..f0b51f8b 100644 --- a/resources/views/pdf/final_log_page_1.blade.php +++ b/resources/views/pdf/final_log_page_1.blade.php @@ -216,8 +216,9 @@
@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 ''; } @endphp diff --git a/resources/views/pdf/final_log_page_1_primayan.blade.php b/resources/views/pdf/final_log_page_1_primayan.blade.php index f5a98f47..1d46220d 100644 --- a/resources/views/pdf/final_log_page_1_primayan.blade.php +++ b/resources/views/pdf/final_log_page_1_primayan.blade.php @@ -216,8 +216,9 @@
@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 ''; } @endphp diff --git a/resources/views/pdf/final_log_page_2.blade.php b/resources/views/pdf/final_log_page_2.blade.php index fc847e9d..64151938 100644 --- a/resources/views/pdf/final_log_page_2.blade.php +++ b/resources/views/pdf/final_log_page_2.blade.php @@ -210,8 +210,9 @@
@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 ''; } @endphp diff --git a/resources/views/pdf/final_log_page_2_primayan.blade.php b/resources/views/pdf/final_log_page_2_primayan.blade.php index d1eae975..279ff93c 100644 --- a/resources/views/pdf/final_log_page_2_primayan.blade.php +++ b/resources/views/pdf/final_log_page_2_primayan.blade.php @@ -210,8 +210,9 @@
@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 ''; } @endphp diff --git a/resources/views/pdf/req_log_page_1.blade.php b/resources/views/pdf/req_log_page_1.blade.php index 3442824b..7b749c20 100644 --- a/resources/views/pdf/req_log_page_1.blade.php +++ b/resources/views/pdf/req_log_page_1.blade.php @@ -224,8 +224,9 @@
@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 ''; } @endphp diff --git a/resources/views/pdf/req_log_page_1_primayan.blade.php b/resources/views/pdf/req_log_page_1_primayan.blade.php index c1a157a9..47896c40 100644 --- a/resources/views/pdf/req_log_page_1_primayan.blade.php +++ b/resources/views/pdf/req_log_page_1_primayan.blade.php @@ -222,8 +222,9 @@
@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 ''; } @endphp