Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
8c91e06d
Commit
8c91e06d
authored
Jun 08, 2016
by
Dominik Hebeler
Browse files
Bilderproxy eingebaut ( erreichbar unter "/meta/picture?url=..."
Bilder der Bildersuche über den Proxy umgeleitet
parent
93192dd5
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/Pictureproxy.php
0 → 100644
View file @
8c91e06d
<?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
app/Http/routes.php
View file @
8c91e06d
...
...
@@ -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'
);
...
...
app/MetaGer.php
View file @
8c91e06d
...
...
@@ -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
resources/views/metager3bilder.blade.php
View file @
8c91e06d
...
...
@@ -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
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment