Merge branch 'hotfix/image-proxy'
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
"type": "project",
|
"type": "project",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.2",
|
"php": "^7.2",
|
||||||
|
"ext-curl": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-libxml": "*",
|
"ext-libxml": "*",
|
||||||
"ext-pdo": "*",
|
"ext-pdo": "*",
|
||||||
|
|||||||
@@ -36,22 +36,7 @@ if ($hash !== $token) {
|
|||||||
die('Access denied');
|
die('Access denied');
|
||||||
}
|
}
|
||||||
|
|
||||||
$ch = curl_init();
|
$imageInfo = getimagesize($url);
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
header('Content-type: '.$imageInfo['mime']);
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
|
||||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_NOBODY, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
$headers = curl_exec($ch);
|
|
||||||
|
|
||||||
if ($headers === false) {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (explode("\r\n", $headers) as $header) {
|
|
||||||
header($header);
|
|
||||||
}
|
|
||||||
|
|
||||||
readfile($url);
|
readfile($url);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
Reference in New Issue
Block a user