Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $script = "<script>";
- $i=0;
- $maxLon = 0;
- $maxLat = 0;
- foreach (glob("Images/*.jpg") as $filename){
- $exif = exif_read_data($filename, 0, true);
- if (array_key_exists("GPS",$exif)){
- $lon = getGps($exif["GPS"]["GPSLongitude"], $exif["GPS"]["GPSLongitudeRef"]);
- $lat = getGps($exif["GPS"]["GPSLatitude"], $exif["GPS"]["GPSLatitudeRef"]);
- $tag = "\"<img src='".$filename."' alt='Image de la position' style='width : 200px; height: 200px;'><a href='image.php?filename=".$filename."'>en savoir plus</a>\"";
- $script = $script.'var popup = L.popup();';
- $script = $script.'L.marker(['.$lat.', '.$lon.']).addTo(mymap).bindPopup('.$tag.').closePopup();'; }
- $i=$i+1;
- $maxLat = $maxLat + $lat;
- $maxLon = $maxLon + $lon;
- }
- $moylat = $maxLat/$i;
- $moylon = $maxLon/$i;
- $script = $script."</script>";
- ?>
- <script>
- var mymap = L.map('testMap').setView([<?php echo $moylat ?>, <?php echo $moylon ?>], 5);
- L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
- maxZoom: 15,
- attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
- '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
- 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
- id: 'mapbox.streets'
- }).addTo(mymap);
- var popup = L.popup();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement