Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <?php
  2. $script = "<script>";
  3.  
  4. $i=0;
  5. $maxLon = 0;
  6. $maxLat = 0;
  7. foreach (glob("Images/*.jpg") as $filename){
  8. $exif = exif_read_data($filename, 0, true);
  9. if (array_key_exists("GPS",$exif)){
  10. $lon = getGps($exif["GPS"]["GPSLongitude"], $exif["GPS"]["GPSLongitudeRef"]);
  11. $lat = getGps($exif["GPS"]["GPSLatitude"], $exif["GPS"]["GPSLatitudeRef"]);
  12. $tag = "\"<img src='".$filename."' alt='Image de la position' style='width : 200px; height: 200px;'><a href='image.php?filename=".$filename."'>en savoir plus</a>\"";
  13. $script = $script.'var popup = L.popup();';
  14. $script = $script.'L.marker(['.$lat.', '.$lon.']).addTo(mymap).bindPopup('.$tag.').closePopup();'; }
  15. $i=$i+1;
  16. $maxLat = $maxLat + $lat;
  17. $maxLon = $maxLon + $lon;
  18. }
  19.  
  20. $moylat = $maxLat/$i;
  21. $moylon = $maxLon/$i;
  22.  
  23. $script = $script."</script>";
  24. ?>
  25. <script>
  26.  
  27. var mymap = L.map('testMap').setView([<?php echo $moylat ?>, <?php echo $moylon ?>], 5);
  28.  
  29. L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
  30. maxZoom: 15,
  31. attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
  32. '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
  33. 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
  34. id: 'mapbox.streets'
  35. }).addTo(mymap);
  36.  
  37. var popup = L.popup();
  38. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement