Améliorations
This commit is contained in:
parent
dfed3ecf11
commit
0fbf9ef188
@ -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,
|
||||
'<a href="' . str_replace('source', 'thumb', $directory) . '/' . self::THUMBS_SEPARATOR . $fileInfos->getFilename() . '" rel="data-lity" data-lity=""><img src="' . str_replace('source', 'thumb', $directory) . '/' . $fileInfos->getFilename() . '"></a>',
|
||||
];
|
||||
self::$picturesId[] = str_replace('.', '', $fileInfos->getFilename());
|
||||
@ -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,10 +413,18 @@ 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);
|
||||
@ -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)
|
||||
|
@ -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;
|
||||
}
|
@ -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('<p>' + location.label + '</p><a href="' + location.img + '" data-lity><img src="' + location.thumb + '" alt="Thumbnail" class="thumbnail"></a>');
|
||||
marker.bindPopup('<p>' + location.label + '</p><a href="' + location.img + '" data-lity><img src="' + location.thumb + '" alt="Thumbnail" class="thumbnail"></a>',{
|
||||
minWidth: 150,
|
||||
maxWidth: 150,
|
||||
minHeight: 150
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user