Php Laravel 5.4响应文件->;文件错误
我正在使用Laravel 5.4并将一些JPEG文件保存到存储中Php Laravel 5.4响应文件->;文件错误,php,file,laravel-5,response,Php,File,Laravel 5,Response,我正在使用Laravel 5.4并将一些JPEG文件保存到存储中 `Storage::disk('local')->put('upload/pictures/full-size/'.$filename ,$picture);` 现在我想再拍一张我喜欢的照片 路线: Route::get('pictures/full/{filename}', ['as' => 'picture_full', 'uses' => 'ImageController@getFull']); 图
`Storage::disk('local')->put('upload/pictures/full-size/'.$filename ,$picture);`
现在我想再拍一张我喜欢的照片
路线:
Route::get('pictures/full/{filename}', ['as' => 'picture_full', 'uses' => 'ImageController@getFull']);
图像控制器:
public function getFull(Image $image)
{
$path = storage_path('app/'.Config::get('pictures.icon_size').$image->filename);
$handler = new \Symfony\Component\HttpFoundation\File\File($path);
$header_content_type = $handler->getMimeType();
$header_content_length = $handler->getSize();
$headers = array(
'Content-Type' => $header_content_type,
'Content-Length' => $header_content_length
);
return response()->file($path, $headers);
}
所以现在我的问题是,文件无法显示。
浏览器显示该文件包含错误
我试了很多,但就是不知道我做错了什么。
有人有主意吗?浏览器控制台向我显示警告-资源被解释为文档,但使用MIME类型图像/jpeg:“URL”传输。我的解决方案是:ob_end_clean();ob_end_clean()救了我的命。浏览器控制台向我显示警告资源,该资源被解释为文档,但使用MIME类型image/jpeg:“URL”传输。我的解决方案是:ob_end_clean();ob_end_clean()救了我的命。