我有一个小问题,即将存储中的图像转换为带有laravel的html。大部分时间它工作正常,但有时我似乎随机得到500内部服务器错误。
HTML
<div style="background:center no-repeat url(/profile/picture/{{Auth::user()->photo}});" class="img-circle m-b emp-img" alt="logo"></div>
路线
Route::get('profile/picture/{image}', function($image = null){
return App\Ratsys\StorageController::getProfilePicture($image);
});
方式
public static function getProfilePicture($file){
return Storage::disk(self::$driver)->get('uploads/employee/picture/'.$file);
}
请求标题
GET /profile/picture/img.jpg HTTP/1.1
Host: ratsys.dev
Connection: keep-alive
Cache-Control: max-age=0
Accept: image/webp,image/*,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Referer: http://ratsys.dev/dashboard
Accept-Encoding: gzip, deflate, sdch
Accept-Language: nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: XSRF-TOKEN=eyJpdiI6IkRMSTBTVUo1QWx1enMxS3FNUHI1MGc9PSIsInZhbHVlIjoiV3l1ZlBMSXRNbmo5TjBCZTkrZVRjK05NWkdycHR6MHh1NkZnTnNUUURtbFdYV0NJblwvZDBuQUtiRlFteWFEeEhWcjZkSjlPd1kyOCtOUlwvV3BIMkprUT09IiwibWFjIjoiMDIxY2E2ZWExNGZlNTljNTQ2OTdiYWFkMjYwYTU2Y2YzZDMwMDI5ZDRmZDIxNjYxYTgxYjc2ODkwNjUxZWE4NyJ9; laravel_session=eyJpdiI6ImFHUGlhR3BRQnlaM2dDeGdzUDB4TkE9PSIsInZhbHVlIjoienMwd1NvZjdNdStJMVA3VkE5dDhwS3dhTFRuK2I1ZlJaS1F1bGl6TmNUUklONTZEbW04T3RRNFFpZklDcFR3TjNGOUZxYzhKNktvWW1LcnFudmRiRmc9PSIsIm1hYyI6IjE5MGNiNzcwNjM5MTk2Yjg2MThkZTQ4NzY1NmNkOTUyYTVmODM2ZDBiZjE3YjA0NDAxNzQwMGY0Yjk0MWVkZWEifQ%3D%3D
响应
HTTP/1.1 500 Internal Server Error
Date: Thu, 31 Mar 2016 07:23:41 GMT
Server: Apache/2.4.9 (Win64) PHP/5.5.12
X-Powered-By: PHP/5.5.12
Cache-Control: no-cache, private
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8