I am getting error "Image not found or type unknown" after downloading PDF in Laravel 5.4 using dompdf package. Here is the method
public function pdf()
{
$users = User::get();
$pdf = PDF::loadView('pdf', compact('users'));
return $pdf->download('Users.pdf');
}
My view file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PDF</title>
</head>
<body>
<div class="container">
<div class="row">
@foreach ($users as $user)
<img src="public/storage/images/{{ $user->profile_pic }}" alt="" style="width: 150px; height: 150px;">
@endforeach
</div>
</div>
</body>
</html>
If I try with static image name (like following), it works
<img src="public/storage/images/image_1.jpg" alt="" style="width: 150px; height: 150px;">
But does not work with dynamic name.
Please suggest how can I can fix it.