Reputation: 121
I use barryvdh/laravel-snappy to generate pdf. But when I add an img it does not show.
Here's my code:
<img src="{{ asset('xx.jpeg') }}" style="height: 50px; width:100px">
but the area of image is blank(gray rectangle)
if I use this:
<img src="xx.jpeg" style="height: 50px; width:100px">
got this error:
Upvotes: 0
Views: 1006
Reputation: 1
For me it worked like this
$pdf = SnappyPdf::setOptions([
'encoding' => 'utf-8',
'enable-local-file-access' => true
])->loadView('report', compact('data'));
And in a blade file
<img alt="" src="{{ public_path().'/images/img.png' }}" height="75px" width="270px"/>
I used these options for the image to load, I hope it helps
Upvotes: 0