mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +00:00
Improved logo display in Invoice/Estimate PDFs
This commit is contained in:
18
app/Space/ImageUtils.php
Normal file
18
app/Space/ImageUtils.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Space;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
|
||||||
|
class ImageUtils
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Convert local path to Base64 encoded data source
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function toBase64Src($path)
|
||||||
|
{
|
||||||
|
return sprintf('data:%s;base64,%s', File::mimeType($path), base64_encode(File::get($path)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -398,7 +398,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
@if ($logo)
|
@if ($logo)
|
||||||
<img class="header-logo" style="height: 50px;" src="{{ $logo }}" alt="Company Logo">
|
<img class="header-logo" style="height:50px" src="{{ \App\Space\ImageUtils::toBase64Src($logo) }}" alt="Company Logo">
|
||||||
@else
|
@else
|
||||||
@if ($estimate->customer->company)
|
@if ($estimate->customer->company)
|
||||||
<h2 class="header-logo"> {{ $estimate->customer->company->name }} </h2>
|
<h2 class="header-logo"> {{ $estimate->customer->company->name }} </h2>
|
||||||
|
|||||||
@@ -420,7 +420,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
@if ($logo)
|
@if ($logo)
|
||||||
<td width="60%" class="header-section-left">
|
<td width="60%" class="header-section-left">
|
||||||
<img class="header-logo" style="height: 50px;" src="{{ $logo }}" alt="Company Logo">
|
<img class="header-logo" style="height:50px" src="{{ \App\Space\ImageUtils::toBase64Src($logo) }}" alt="Company Logo">
|
||||||
</td>
|
</td>
|
||||||
@else
|
@else
|
||||||
<td width="60%" class="header-section-left" style="padding-top: 0px;">
|
<td width="60%" class="header-section-left" style="padding-top: 0px;">
|
||||||
|
|||||||
@@ -358,7 +358,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td width="50%" class="header-section-left">
|
<td width="50%" class="header-section-left">
|
||||||
@if ($logo)
|
@if ($logo)
|
||||||
<img class="header-logo" style="height: 50px;" src="{{ $logo }}" alt="Company Logo">
|
<img class="header-logo" style="height:50px" src="{{ \App\Space\ImageUtils::toBase64Src($logo) }}" alt="Company Logo">
|
||||||
@else
|
@else
|
||||||
<h1 class="header-logo"> {{ $estimate->customer->company->name }} </h1>
|
<h1 class="header-logo"> {{ $estimate->customer->company->name }} </h1>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -328,9 +328,6 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@if (App::isLocale('th'))
|
|
||||||
@include('app.pdf.locale.th')
|
|
||||||
@endif
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -339,7 +336,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
@if ($logo)
|
@if ($logo)
|
||||||
<img class="header-logo" style="height:50px" src="{{ "data:".mime_content_type($logo).";base64,".base64_encode(file_get_contents($logo)) }}" alt="Company Logo">
|
<img class="header-logo" style="height:50px" src="{{ \App\Space\ImageUtils::toBase64Src($logo) }}" alt="Company Logo">
|
||||||
@else
|
@else
|
||||||
@if ($invoice->customer->company)
|
@if ($invoice->customer->company)
|
||||||
<h2 class="header-logo"> {{ $invoice->customer->company->name }}</h2>
|
<h2 class="header-logo"> {{ $invoice->customer->company->name }}</h2>
|
||||||
|
|||||||
@@ -389,7 +389,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td width="60%" class="header-section-left">
|
<td width="60%" class="header-section-left">
|
||||||
@if ($logo)
|
@if ($logo)
|
||||||
<img class="header-logo" src="{{ "data:".mime_content_type($logo).";base64,".base64_encode(file_get_contents($logo)) }}" alt="Company Logo" style="height: 50px;">
|
<img class="header-logo" style="height:50px" src="{{ \App\Space\ImageUtils::toBase64Src($logo) }}" alt="Company Logo">
|
||||||
@elseif ($invoice->customer->company)
|
@elseif ($invoice->customer->company)
|
||||||
<h1 class="header-logo" style="padding-top: 0px;">
|
<h1 class="header-logo" style="padding-top: 0px;">
|
||||||
{{ $invoice->customer->company->name }}
|
{{ $invoice->customer->company->name }}
|
||||||
|
|||||||
@@ -318,7 +318,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td width="50%" class="header-section-left">
|
<td width="50%" class="header-section-left">
|
||||||
@if ($logo)
|
@if ($logo)
|
||||||
<img class="header-logo" style="height: 50px;" src="{{ "data:".mime_content_type($logo).";base64,".base64_encode(file_get_contents($logo)) }}" alt="Company Logo">
|
<img class="header-logo" style="height:50px" src="{{ \App\Space\ImageUtils::toBase64Src($logo) }}" alt="Company Logo">
|
||||||
@else
|
@else
|
||||||
<h1 class="header-logo"> {{ $invoice->customer->company->name }} </h1>
|
<h1 class="header-logo"> {{ $invoice->customer->company->name }} </h1>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
Reference in New Issue
Block a user