Simplify and fix image proxy

This commit is contained in:
Björn Fromme
2019-11-06 11:49:22 +01:00
parent 5f480c72e5
commit f500f987d5
2 changed files with 3 additions and 17 deletions
+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;