Set headers to allow access from any origin
This commit is contained in:
parent
90b33b590a
commit
0d8e8c5ba7
|
@ -36,6 +36,11 @@ function displayImage($url, $userAgent, $redirect)
|
||||||
// don't need to fetch the image if we're redirecting
|
// don't need to fetch the image if we're redirecting
|
||||||
$contents = $redirect ? "" : curlGetContents($url, $userAgent);
|
$contents = $redirect ? "" : curlGetContents($url, $userAgent);
|
||||||
|
|
||||||
|
// Set headers to allow access from any origin
|
||||||
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
header("Access-Control-Allow-Methods: GET, OPTIONS");
|
||||||
|
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With");
|
||||||
|
|
||||||
// redirect if redirect is set or the image is larger than 4.5MB
|
// redirect if redirect is set or the image is larger than 4.5MB
|
||||||
if ($redirect || strlen($contents) > 4500000) {
|
if ($redirect || strlen($contents) > 4500000) {
|
||||||
header("Location: $url");
|
header("Location: $url");
|
||||||
|
|
Loading…
Reference in New Issue