diff --git a/controllers/controllers.php b/controllers/controllers.php index 9e724d9..fab24de 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -355,9 +355,14 @@ $app->get('/options.json', function() use($app) { }); $app->get('/map.png', function() use($app) { - $url = static_map_service($_SERVER['QUERY_STRING']); - $ch = curl_init($url); + $params = $app->request()->params(); + $params['basemap'] = 'custom'; + $params['tileurl'] = Config::$mapTileURL; + $params['token'] = Config::$atlasToken; + + $ch = curl_init('https://atlas.p3k.io/map/img'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); $img = curl_exec($ch); header('Expires: ' . gmdate('D, d M Y H:i:s', strtotime('+30 days')) . ' GMT'); header('Pragma: cache'); diff --git a/lib/config.template.php b/lib/config.template.php index 1c70676..fa81a12 100644 --- a/lib/config.template.php +++ b/lib/config.template.php @@ -13,6 +13,9 @@ class Config { public static $mf2Debug = false; + public static $atlasToken = ''; + public static $mapTileURL = ''; + public static $alexaClientID = ''; public static $alexaClientSecret = ''; public static $alexaRedirectURIs = [ diff --git a/lib/helpers.php b/lib/helpers.php index b3a89d4..c1a79f9 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -196,11 +196,7 @@ function get_micropub_config(&$user) { } function build_static_map_url($latitude, $longitude, $height, $width, $zoom) { - return '/map.png?marker[]=lat:' . $latitude . ';lng:' . $longitude . ';icon:small-green-cutout&basemap=topo&width=' . $width . '&height=' . $height . '&zoom=' . $zoom; -} - -function static_map_service($query) { - return 'https://atlas.p3k.io/map/img?' . $query; + return '/map.png?marker[]=lat:' . $latitude . ';lng:' . $longitude . ';icon:small-green-cutout&width=' . $width . '&height=' . $height . '&zoom=' . $zoom; } function relative_time($date) {