Merge branch 'hotfix/image-proxy'

This commit is contained in:
Björn Fromme
2019-11-06 11:49:27 +01:00
2 changed files with 3 additions and 17 deletions
+1
View File
@@ -8,6 +8,7 @@
"type": "project",
"require": {
"php": "^7.2",
"ext-curl": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-pdo": "*",
+2 -17
View File
@@ -36,22 +36,7 @@ if ($hash !== $token) {
die('Access denied');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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);
}
$imageInfo = getimagesize($url);
header('Content-type: '.$imageInfo['mime']);
readfile($url);
exit;