diff --git a/module/geogallery/geogallery.php b/module/geogallery/geogallery.php index ac16b61c..d917e0fc 100644 --- a/module/geogallery/geogallery.php +++ b/module/geogallery/geogallery.php @@ -353,8 +353,8 @@ class geogallery extends common // Données géographiques foreach ((array) $this->getInput('legend', null) as $file => $data) { $geo[str_replace('.', '', $file)] = [ - 'long' => $this->getInput('gpslong[' . $file . ']'), - 'lat' => $this->getInput('gpslat[' . $file . ']') + 'long' => $this->getInput('gpslong[' . $file . ']', helper::FILTER_FLOAT), + 'lat' => $this->getInput('gpslat[' . $file . ']', helper::FILTER_FLOAT) ]; } // Sauvegarder @@ -493,7 +493,7 @@ class geogallery extends common $iterator = new DirectoryIterator($directory); foreach ($iterator as $fileInfos) { if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) { - self::$galleries[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'legend', str_replace('.', '', $fileInfos->getFilename())]); + // Créer la miniature si manquante if (!file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) { $this->makeThumb( @@ -504,11 +504,18 @@ class geogallery extends common } $exif = exif_read_data($fileInfos->getPath() . '/' . $fileInfos->getFilename()); // Vérifier si les données EXIF contiennent des informations de géolocalisation - if (!empty($exif['GPSLatitude']) && !empty($exif['GPSLongitude'])) { + if (!empty($exif['GPSLatitude']) || !empty($exif['GPSLongitude'])) { // Coordonnées - self::$galleries[$directory . '/' . $fileInfos->getFilename()] = [ + self::$galleries[] = [ 'lat' => $this->gps_decimal($exif['GPSLatitude'], $exif['GPSLatitudeRef']), - 'long' => $this->gps_decimal($exif['GPSLongitude'], $exif['GPSLatitudeRef']) + 'long' => $this->gps_decimal($exif['GPSLongitude'], $exif['GPSLatitudeRef']), + 'thumb' => str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()) + ]; + } else { + self::$galleries[] = [ + 'lat' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'positions', 'directory', str_replace('.', '', $fileInfos->getFilename())]) , + 'long' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'positions', 'directory', str_replace('.', '', $fileInfos->getFilename())]), + 'thumb' => str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()) ]; } diff --git a/module/geogallery/view/index/index.js.php b/module/geogallery/view/index/index.js.php index 7676d755..49ef6fba 100644 --- a/module/geogallery/view/index/index.js.php +++ b/module/geogallery/view/index/index.js.php @@ -12,54 +12,21 @@ * @link http://zwiicms.fr/ */ -// Récupérer les données JSON des positions des images -var jsonData = ""; -jsonData = JSON.parse(jsonData); + // Initialisation de la carte + var map = L.map('map').setView([51.505, -0.09], 2); -// Initialize the map -var map = L.map('map').setView([51.505, -0.09], 5); + // Ajouter une couche de tuiles OpenStreetMap + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors' + }).addTo(map); -// Add OpenStreetMap tile layer -L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - maxZoom: 19, -}).addTo(map); + // Les données PHP converties en JSON pour JavaScript + const json = ''; + const obj = JSON.parse(json); -// Helper function to create a popup content -function createPopupContent(image, legend, directory) { - var imageUrl = directory + '/' + image; - var legendText = legend[image.replace('.jpg', 'jpg')]; - return ` -
${legendText}
-- -