Created
November 30, 2020 09:03
-
-
Save bfritscher/3b5b5c9bddcc863b2eeb1cc13ab32355 to your computer and use it in GitHub Desktop.
roundshot image proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('../myfeeds/core.php'); | |
if (!isset($_GET['site']) or !isset($_GET['size'])) { | |
print("site: roundshot subdomain chaumont, neuchatel, lacdeneuchatel, jeunesrives, nyon-tourisme, morgesregion<br>morgesregion folder: ville<br>size: full, half, quarter, oneeighth, thumbnail"); | |
die(); | |
} | |
$site = $_GET['site']; | |
$size = $_GET['size']; | |
$folder = isset($_GET['folder']) ? $_GET['folder'] . '/' : ''; | |
$json = json_decode(file_get_contents("https://$site.roundshot.co/{$folder}structure.json")); | |
if (isset($_GET['x']) and isset($_GET['y'])) { | |
$img_url = $json->images[0]->structure->{$size}->url_tile; | |
$img_url = str_replace('%x%', $_GET['x'], $img_url); | |
$img_url = str_replace('%y%', $_GET['y'], $img_url); | |
} else { | |
$img_url = $json->images[0]->structure->{$size}->url_full; | |
} | |
$response = get_web_page($img_url); | |
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | |
header("Cache-Control: post-check=0, pre-check=0", false); | |
header("Pragma: no-cache"); | |
header("Content-Type: ". $response["content_type"]); | |
echo $response['content']; | |
///%x%_%y% | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment