php - Laravel dompdf error "Image not found or type unknown" -


i getting error "image not found or type unknown" after downloading pdf in laravel 5.4 using dompdf package. here 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 $user)                 <img src="public/storage/images/{{ $user->profile_pic }}" alt="" style="width: 150px; height: 150px;">             @endforeach         </div>     </div> </body> </html> 

if try static image name (like following), works

<img src="public/storage/images/image_1.jpg" alt="" style="width: 150px; height: 150px;"> 

but not work dynamic name.

please suggest how can can fix it.

according this question have use full server path try:

<img src="{{ public_path("storage/images/".$user->profile_pic) }}" alt="" style="width: 150px; height: 150px;"> 

assuming image stored in public directory.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -