根據問題標題,我正在使用Laravel的干預軟件包。我在我的路線下面的代碼:干預Laravel的圖像緩存:一次運行,然後「圖像無法顯示,因爲它包含錯誤」
Route::get('resize-image/{pathkey}/{filename}/{w?}/{h?}', function($pathkey, $filename, $w=100, $h=100){
$cacheimage = Image::cache(function($image) use($pathkey, $filename, $w, $h){
switch($pathkey){
case 'tour-images':
$filepath = 'upload/tour-images/' . $filename;
break;
}
return $image->make($filepath)->resize($w,$h);
},10,true); // cache for 10 minutes
return Response::make($cacheimage, 200, array('Content-Type' => 'image/jpeg'));
});
當我使用類似呼叫圖片:/resize-image/tour-images/139326085726.jpg/1100/400
它工作得很好,然後當我重新載入頁面,我得到的錯誤:
圖像xxxx不能顯示,因爲它包含錯誤
如果我改變尺寸(所以迫使它再次調整圖像大小),它的工作原理,然後..同樣的問題。當我重新加載頁面時,它應該是這次加載的緩存圖像...但它不起作用。發生什麼事?
什麼是您的緩存驅動程序? – ceejayoz
它在config/cache.php中設置爲'file' – Inigo