From b2ec021f4b9399808a647934690b92456c34bba7 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sat, 9 May 2015 22:19:16 +0200 Subject: [PATCH] attempt to clean up map URLs --- controllers/controllers.php | 6 ++++-- lib/helpers.php | 5 ++--- views/new-post.php | 4 ++-- views/partials/entry.php | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/controllers/controllers.php b/controllers/controllers.php index 214eaa3..b898539 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -239,11 +239,13 @@ $app->get('/options', function() use($app) { }); $app->get('/map.png', function() use($app) { - $params = $app->request()->params(); - $url = get_static_map($_SERVER['QUERY_STRING']); + $url = static_map_service($_SERVER['QUERY_STRING']); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $img = curl_exec($ch); + header('Expires: ' . gmdate('D, d M Y H:i:s', strtotime('+30 days')) . ' GMT'); + header('Pragma: cache'); + header('Cache-Control: private'); $app->response()['Content-type'] = 'image/png'; $app->response()->body($img); }); diff --git a/lib/helpers.php b/lib/helpers.php index 12c0c02..f7353ee 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -170,12 +170,11 @@ function get_syndication_targets(&$user) { ); } -function static_map($latitude, $longitude, $height=174, $width=300, $zoom=14) { - #return 'http://static-maps.pdx.esri.com/img.php?marker[]=lat:' . $latitude . ';lng:' . $longitude . ';icon:small-green-cutout&basemap=topo&width=' . $width . '&height=' . $height . '&zoom=' . $zoom; +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 get_static_map($query) { +function static_map_service($query) { return 'http://static-maps.pdx.esri.com/img.php?' . $query; } diff --git a/views/new-post.php b/views/new-post.php index 3115a42..264da6d 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -86,8 +86,8 @@ $(function(){ $("#note_location_msg").removeClass("img-visible"); } - var map_template_wide = ""; - var map_template_small = ""; + var map_template_wide = ""; + var map_template_small = ""; function fetch_location() { $("#note_location_loading").show(); diff --git a/views/partials/entry.php b/views/partials/entry.php index e7736f5..78a3b97 100644 --- a/views/partials/entry.php +++ b/views/partials/entry.php @@ -1,7 +1,7 @@
  • entry->latitude): ?> - +