From 0fbf9ef188ec727c6e8354e474e56240487ca995 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 8 Aug 2024 11:33:55 +0200 Subject: [PATCH] =?UTF-8?q?Am=C3=A9liorations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/geogallery/geogallery.php | 81 +++++++---------------- module/geogallery/view/index/index.css | 22 ++---- module/geogallery/view/index/index.js.php | 6 +- 3 files changed, 34 insertions(+), 75 deletions(-) diff --git a/module/geogallery/geogallery.php b/module/geogallery/geogallery.php index e039a4d8..4ff4172f 100644 --- a/module/geogallery/geogallery.php +++ b/module/geogallery/geogallery.php @@ -49,12 +49,8 @@ class geogallery extends common 'config' => self::GROUP_EDITOR, 'delete' => self::GROUP_EDITOR, 'dirs' => self::GROUP_EDITOR, - 'sortGalleries' => self::GROUP_EDITOR, - 'sortPictures' => self::GROUP_EDITOR, 'edit' => self::GROUP_EDITOR, 'add' => self::GROUP_EDITOR, - 'theme' => self::GROUP_EDITOR, - 'option' => self::GROUP_EDITOR, 'index' => self::GROUP_VISITOR ]; @@ -66,7 +62,7 @@ class geogallery extends common private function update() { - $versionData = $this->getData(['module', $this->getUrl(0), 'config', 'versionData']); + //$versionData = $this->getData(['module', $this->getUrl(0), 'config', 'versionData']); } @@ -322,15 +318,15 @@ class geogallery extends common 'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'legend', str_replace('.', '', $fileInfos->getFilename())]) ]), /*template::text('gpslong[' . $fileInfos->getFilename() . ']', [ - 'value' => $longitude, - 'readonly' => true, - ]),*/ + 'value' => $longitude, + 'readonly' => true, + ]),*/ $longitude, /* template::text('gpslat[' . $fileInfos->getFilename() . ']', [ - 'value' => $latitude, - 'readonly' => true, - ]), - */$latitude, + 'value' => $latitude, + 'readonly' => true, + ]), + */ $latitude, '', ]; self::$picturesId[] = str_replace('.', '', $fileInfos->getFilename()); @@ -360,7 +356,7 @@ class geogallery extends common $directory = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'directory']); if (is_dir($directory)) { $iterator = new DirectoryIterator($directory); - + foreach ($iterator as $fileInfos) { if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) { @@ -373,6 +369,7 @@ class geogallery extends common self::THUMBS_WIDTH ); } + $exif = exif_read_data($fileInfos->getPath() . '/' . $fileInfos->getFilename()); // Vérifier si les données EXIF contiennent des informations de géolocalisation @@ -381,7 +378,7 @@ class geogallery extends common self::$galleries[] = [ 'lat' => $this->gps_decimal($exif['GPSLatitude'], $exif['GPSLatitudeRef']), 'long' => $this->gps_decimal($exif['GPSLongitude'], $exif['GPSLatitudeRef']), - 'img'=> $fileInfos->getPath() . '/' . strtolower($fileInfos->getFilename()), + 'img' => $fileInfos->getPath() . '/' . strtolower($fileInfos->getFilename()), 'thumb' => str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()), 'label' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'legend', str_replace('.', '', $fileInfos->getFilename())]) ]; @@ -389,7 +386,7 @@ class geogallery extends common self::$galleries[] = [ 'lat' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'position', 'directory', str_replace('.', '', $fileInfos->getFilename())]), 'long' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'position', 'directory', str_replace('.', '', $fileInfos->getFilename())]), - 'img'=> $fileInfos->getPath() . '/' . strtolower($fileInfos->getFilename()), + 'img' => $fileInfos->getPath() . '/' . strtolower($fileInfos->getFilename()), 'thumb' => str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()), 'label' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'legend', str_replace('.', '', $fileInfos->getFilename())]) ]; @@ -416,16 +413,24 @@ class geogallery extends common // Calculer la distance maximale au centre pour déterminer le niveau de zoom $maxDistance = 0; foreach (self::$galleries as $coordinate) { - $distance = $this->haversineGreatCircleDistance($centerLat, $centerLong, $coordinate["lat"], $coordinate["long"]); - if ($distance > $maxDistance) { - $maxDistance = $distance; + if ( + is_numeric($centerLat) + && is_numeric($centerLong) + && $coordinate["lat"] + && $coordinate["long"] + ) { + $distance = $this->haversineGreatCircleDistance($centerLat, $centerLong, $coordinate["lat"], $coordinate["long"]); + if ($distance > $maxDistance) { + $maxDistance = $distance; + } } + } $zoomLevel = $this->getZoomLevel($maxDistance); self::$galleriesCenter = array( - 'lat' => $centerLat, + 'lat' => $centerLat, 'long' => $centerLong, 'zoom' => $zoomLevel ); @@ -443,44 +448,6 @@ class geogallery extends common } } - /** - * Thème de la galerie - */ - public function theme() - { - // Soumission du formulaire - if ( - $this->getUser('permission', __CLASS__, __FUNCTION__) === true && - $this->isPost() - ) { - // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) { - mkdir(self::DATADIRECTORY . $this->getUrl(0), 0755, true); - } - $this->setData([ - 'module', - $this->getUrl(0), - 'theme', - [ - ] - ]); - $success = true; - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl() . '/theme', - 'notification' => $success ? 'Modifications enregistrées' : 'Modifications non enregistrées !', - 'state' => $success - ]); - } - // Valeurs en sortie - $this->addOutput([ - 'title' => helper::translate('Thème'), - 'view' => 'theme', - 'vendor' => [ - 'tinycolorpicker' - ] - ]); - } // Fonction pour convertir les coordonnées GPS au format décimal private function gps_decimal($coordinate, $hemisphere) diff --git a/module/geogallery/view/index/index.css b/module/geogallery/view/index/index.css index 9506f6b7..97c8bdce 100644 --- a/module/geogallery/view/index/index.css +++ b/module/geogallery/view/index/index.css @@ -13,22 +13,10 @@ */ #map { - height: 400px; -} - -.lity-wrap { - width: auto !important; - height: auto !important; - max-width: 90%; - max-height: 90%; - display: flex; - align-items: center; - justify-content: center; -} - -.lity-content img { + height: 500px; width: auto; - max-width: 100%; - height: auto; - max-height: 100%; +} +.leaflet-popup-content { + text-align: center; + font-weight: bold; } \ No newline at end of file diff --git a/module/geogallery/view/index/index.js.php b/module/geogallery/view/index/index.js.php index c9fc8ccc..0f5f71f5 100644 --- a/module/geogallery/view/index/index.js.php +++ b/module/geogallery/view/index/index.js.php @@ -35,5 +35,9 @@ const objOptions = JSON.parse(jsonOptions); obj.forEach(function(location) { var marker = L.marker([location.lat, location.long], {title: location.label}); marker.addTo(map); - marker.bindPopup('

' + location.label + '

Thumbnail'); + marker.bindPopup('

' + location.label + '

Thumbnail',{ + minWidth: 150, + maxWidth: 150, + minHeight: 150 + }); }); \ No newline at end of file