0

My question is very simple

I am trying to call this source in my public folder in img folder:

src="img/vcc3logo.png" 

But I can't display it on my pdf print form

When the customer print for a certification form it needed to display the image. The file of the print.blade.php is located in resources/views/customer-relations/dashboard/print.blade.php

Here is the code in my print.blade.php

 {{-- <div class="content"> <div class="clearfix"></div> <div class="box-body"> --}} <img src="" height="50" width="50" style="float: right"> <img src="img/vcc3logo.png" height="50" width="50" style="float: left"> <div class="container"> <div class="row"> <div class="text-center"> <p class="text-center maliit"> Republic of the Philippines<br> National Capital Region<br> <font>City Government of Valenzuela</font><br> Office of the City Mayor<br> Valenzuela City Command and Communications Center<br> 2nd Floor, City ALERT Center, Mc-Arthur Hi-way, Malinta, Valenzuela City<br> </p> <h3>Application Number:{{ $application_number }}</h3> </div> <h5><b>Business Name:</b> {{ $business_name }}</h5> <h5><b>Owner:</b> {{ $owner }}</h5> <h5><b>Location:</b> {{ $location }}</h5> </span> <table class="table table-hover"> <thead> <tr> <th>Fees</th> <th></th> <th class="text-center"></th> <th class="text-center"></th> </tr> </thead> <tbody> <tr> <td class="col-md-9"><em>Inspection Fee:</em></h4></td> <td class="col-md-1" style="text-align: center"></td> <td class="col-md-1 text-center"></td> <td class="col-md-1 text-center">{{ $inspection_fee }}</td> </tr> <tr> <td class="col-md-9"><em>Certificate Fee:</em></h4></td> <td class="col-md-1" style="text-align: center"></td> <td class="col-md-1 text-center"></td> <td class="col-md-1 text-center">{{ $cert_fee }}</td> </tr> <tr> <td class="col-md-9"><em>Local Fee:</em></h4></td> <td class="col-md-1" style="text-align: center"></td> <td class="col-md-1 text-center"></td> <td class="col-md-1 text-center">{{ $local_fee }}</td> </tr> <tr> <td class="col-md-9"><em>Others Fee:</em></h4></td> <td class="col-md-1" style="text-align: center"></td> <td class="col-md-1 text-center"></td> <td class="col-md-1 text-center">{{ $others_fee }}</td> </tr> </tbody> </table> <p><i>Note: Please print and present to Customer Relations Officer</i></p> </td> </div> {{-- </div> </div> </div> --}} 

I tried to change it to

src="url('/img/cctv_camera.jpg')" 

but ended up with this error:

(1/1) RuntimeException The exit status code '1' says something went wrong: stderr: "Loading pages (1/6)

2 Answers 2

1

If image file is located inside public folder then you need to add asset() which give full path of image like

<img src="{{asset('/img/vcc3logo.png')}}" height="50" width="50" style="float: left"> 
Sign up to request clarification or add additional context in comments.

5 Comments

Thanks! Never heard of that. I am just new to Laravel. But it takes time to reload the page when I change the code to src="{{asset('/img/vcc3logo.png')}}"
@JayzdeVera Any way congrats. If you have got solution to your problem then please do not forgot to close question by accepting it later :)
btw I ended up with this error : (1/1) ProcessTimedOutException The process "/home/jayzdevera/Documents/CrudCCTV/cctv-crud/web/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality '/tmp/knp_snappy598a76187aacc3.07751285.html' '/tmp/knp_snappy598a76187ab6d4.11019290.pdf'" exceeded the timeout of 60 seconds. When I changed the code to src="{{asset('/img/vcc3logo.png')}}
@JayzdeVera It seems problem with your pdf generation. does pdf size is too large or computation is complex and don't complete in 60 second
@JayzdeVera See this issue in github github.com/barryvdh/laravel-snappy/issues/105
1

I think you can try this hope its help for you :

<img src="{{url('')}}/img/vcc3logo.png" height="50" width="50" style="float: left"> 

OR

<img src="{{asset('/img/vcc3logo.png')}}" height="50" width="50" style="float: left"> 

Hope this work for you !!!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.