Commit 55b934b0 authored by Dominik Hebeler's avatar Dominik Hebeler

Merge branch 'Bugfix' into 'development'

Wenn der PictureProxy ein Bild nicht abrufen kann, wirft er keinen Error mehr



See merge request !185
parents fc1f12ba 4b7bb498
......@@ -17,19 +17,24 @@ class Pictureproxy extends Controller
function get(Request $request) {
if( $request->has('url') )
{
$file = file_get_contents($request->input('url'));
$responseCode = explode(" ", $http_response_header[0])[1];
$contentType = "";
foreach($http_response_header as $header)
{
if( strpos($header, "Content-Type:") === 0)
try{
$file = file_get_contents($request->input('url'));
$responseCode = explode(" ", $http_response_header[0])[1];
$contentType = "";
foreach($http_response_header as $header)
{
$tmp = explode(": ", $header);
$contentType = $tmp[1];
if( strpos($header, "Content-Type:") === 0)
{
$tmp = explode(": ", $header);
$contentType = $tmp[1];
}
}
$response = Response::make($file, $responseCode);
$response->header('Content-Type', $contentType);
}catch(\ErrorException $e)
{
$response = Response::make("", 404);
}
$response = Response::make($file, $responseCode);
$response->header('Content-Type', $contentType);
return $response;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment