Commit 8c91e06d authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Bilderproxy eingebaut ( erreichbar unter "/meta/picture?url=..."

Bilder der Bildersuche über den Proxy umgeleitet
parent 93192dd5
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
#use App\MetaGer\Forwarder;
#use App\MetaGer\Results;
#use App\MetaGer\Search;
use App;
use App\MetaGer;
use Response;
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)
{
$tmp = explode(": ", $header);
$contentType = $tmp[1];
}
}
$response = Response::make($file, $responseCode);
$response->header('Content-Type', $contentType);
return $response;
}
}
}
\ No newline at end of file
......@@ -97,6 +97,7 @@
Route::get('meta/meta.ger3', 'MetaGerSearch@search');
Route::get('meta/picture', 'Pictureproxy@get');
Route::get('qt', 'MetaGerSearch@quicktips');
Route::get('tips', 'MetaGerSearch@tips');
......
......@@ -716,4 +716,11 @@ class MetaGer
else
return null;
}
public function getImageProxyLink($link)
{
$requestData = [];
$requestData["url"] = $link;
$link = action('Pictureproxy@get', $requestData);
return $link;
}
}
\ No newline at end of file
......@@ -7,7 +7,7 @@
<div class="item">
<div class="img">
<a href="{{ $result->link }}" target="{{ $metager->getTab() }}">
<img src="{{ $result->image }}" width="150px" alt="Bild nicht gefunden"/>
<img src="{{ $metager->getImageProxyLink($result->image) }}" width="150px" alt="Bild nicht gefunden"/>
</a>
</div>
</div>
......
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