Skip to content

Commit f6567f5

Browse files
authored
Merge pull request #166 from Dartui/master
use file mime type instead of file extension for generating logo url
2 parents 94ee2ce + ca2f7c3 commit f6567f5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"php": "^7.3|^8.0",
1717
"barryvdh/laravel-dompdf": "^v2.0",
1818
"illuminate/http": "^5.5|^6|^7|^8|^9",
19-
"illuminate/support": "^5.5|^6|^7|^8|^9"
19+
"illuminate/support": "^5.5|^6|^7|^8|^9",
20+
"symfony/http-foundation": "^4.0|^5.0|^6.0"
2021
},
2122
"require-dev": {
2223
"phpunit/phpunit": "^9.3",

src/Traits/InvoiceHelpers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Support\Str;
77
use LaravelDaily\Invoices\Contracts\PartyContract;
88
use LaravelDaily\Invoices\Services\PricingService;
9+
use Symfony\Component\HttpFoundation\File\File;
910

1011
/**
1112
* Trait InvoiceHelpers.
@@ -202,10 +203,9 @@ public function getTotalAmountInWords()
202203

203204
public function getLogo()
204205
{
205-
$type = pathinfo($this->logo, PATHINFO_EXTENSION);
206-
$data = file_get_contents($this->logo);
206+
$file = new File($this->logo);
207207

208-
return 'data:image/' . $type . ';base64,' . base64_encode($data);
208+
return 'data:' . $file->getMimeType() . ';base64,' . base64_encode($file->getContent());
209209
}
210210

211211
/**

0 commit comments

Comments
 (0)