2017-08-09 94 views
0

我的問題很簡單如何調用公共文件夾中的圖像laravel 5.4

我想在IMG文件夾來調用這個源在我的公用文件夾:

src="img/vcc3logo.png" 

但我無法顯示它在我的pdf打印表格

當客戶打印認證表單時,需要顯示圖像。該print.blade.php的文件位於資源/視圖/客戶關係/儀表板/ print.blade.php

這裏是我的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> 
--}} 

我的代碼試圖將其更改爲

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

,但最終與此錯誤:

(1/1)的RuntimeException 退出狀態碼 '1' 說出事了: 標準錯誤:「加載頁面(1/6)

回答

1

如果圖像文件位於公共文件夾內,然後你需要添加asset()這給像

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

謝謝!從來沒有聽說過。我只是Laravel的新手。但是,當我將代碼更改爲src =「{{asset('/ img/vcc3logo.png')}}」 –

+0

@JayzdeVera祝賀任何方式時,重新加載頁面需要時間。如果你已經解決了你的問題,那麼請不要忘記通過接受它來關閉問題:) –

+0

btw我結束了這個錯誤: (1/1)ProcessTimedOutException 進程「/ 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'「超過了60秒。 當我將代碼更改爲src =「{{asset('/ img/vcc3logo.png')}} –

0

圖像的完整路徑,我覺得你可以試試這個希望它爲您的幫助:

<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"> 

希望爲你工作!!!

相關問題