根据问题标题,我正在使用 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 无法显示,因为它包含错误
如果我更改尺寸(因此强制它再次调整图像大小),它可以工作,那么......同样的问题。当我重新加载页面时,它应该是这次加载的缓存图像......但它不起作用。怎么了?