Skip to content
Snippets Groups Projects
Commit 76258fa3 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch 'Bugfix' into 'development'

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



See merge request !185
parents 28a910a0 02838458
No related branches found
No related tags found
1 merge request!1365Resolve "Filter Options for MetaGer"
......@@ -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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment