2014-10-27 26 views
0

我有一個帶有這段代碼的刀片視圖文件。getimagesize()讀取錯誤laravel -blade-view

@if(count($news)) 
         @foreach($news as $nieuwtje) 

         <?php list($width, $height) = getimagesize(public_path() . '/uploads/nieuwtjes/small/' . $nieuwtje->image); ?> 
          <li> 

           {{ HTML::image(public_path() . '/uploads/nieuwtjes/small/' . $nieuwtje->image,'', array('class' => 'scale-with-grid', 'height' => $height, 'width' => $width)); }} 
           <div class="slide-cnt"> 
            <h2>{{{$nieuwtje->title}}}</h2> 
            <p>{{{$nieuwtje->first_paragraph}}} </p> 
            <a href="#" class="red-btn">Lees hier meer!</a> 
           </div> 
          </li> 
         @endforeach 
         @endif 

當我回顯$ width或$ height時,它打印出正確的值。 有人可以幫助我嗎?

謝謝!

+0

可能的修復在這裏:http://stackoverflow.com/questions/10175758/getimagesize-read-error – Mason8r 2014-10-27 14:48:33

回答

0

此錯誤是因爲圖像不提供的路徑

echo this path: public_path() . '/uploads/nieuwtjes/small/' . $nieuwtje->image; 

存在,看看圖像是否。

0

您是否有權訪問公用文件夾?即使您有權訪問該文件夾,但在將新圖像添加到該文件夾​​時,可能會遇到問題。新添加的圖像可能無法訪問。

在max os和linux上檢查'ls -a'映像上的訪問。

希望這會有所幫助。