lundi 11 novembre 2019

Laravel Dompdf Image not found or type unknown

I'm trying to get the user image in our application when downloading pdf, my problem now is that the uploaded images will display Image not found or type unknown. Tried what was suggested here, but got no luck. My image url is in full path like http://localhost/storage/app/public/pic/user_pic/82ac9404bdb74d0ad980a30faadeab22cd41b38d.jpg. I also tried doing it this way : <td><img src="" style="height:200px; width:300px"><td>, and still no luck. Here's my full code in downloading the pdf:

Controller

$users = $this->userListService->getUserDataPDF($request);
$pdf = PDF::loadView('pdf.user_pdf', compact('guests'))->setPaper('','landscape');
$pdf->getDomPDF()->setHttpContext(
    stream_context_create([
        'ssl' => [
            'allow_self_signed'=> TRUE,
            'verify_peer' => FALSE,
            'verify_peer_name' => FALSE,
        ]
    ])
);

return $pdf->download(Carbon::now()->format('Ymd') . 'user.pdf',compact('users','pdf'));

view

<tr>
    <td><img src="" style="height:200px; width:300px"></td>
</tr>

Someone has an idea on this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire