Skip to content

Commit

Permalink
fix logo
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Jan 20, 2025
1 parent cda81b7 commit 0b44f6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion resources/views/default/invoice.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</td>
@if ($invoice->logo)
<td class="p-0 align-top" width="30%">
<img src="{{ $invoice->getLogo() }}" alt="logo" height="100">
<img src="{{ $invoice->logo }}" alt="logo" height="100">
</td>
@endif
</tr>
Expand Down
17 changes: 5 additions & 12 deletions src/PdfInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class PdfInvoice
* @param array<string, mixed> $seller
* @param PdfInvoiceItem[] $items
* @param InvoiceDiscount[] $discounts
* @param ?string $logo A local file path. The file must be accessible using file_get_contents.
*/
public function __construct(
public ?string $name = null,
Expand Down Expand Up @@ -75,20 +76,12 @@ public function getCurrency(): string
return $firstItem?->currency->getCurrencyCode() ?? config()->string('invoices.default_currency');
}

/**
* @deprecated Using $this->logo
*/
public function getLogo(): ?string
{
if (! $this->logo) {
return null;
}

$type = pathinfo($this->logo, PATHINFO_EXTENSION);

if ($data = file_get_contents($this->logo)) {
return 'data:image/'.$type.';base64,'.base64_encode($data);
}

return null;

return $this->logo;
}

/**
Expand Down

0 comments on commit 0b44f6d

Please sign in to comment.