ZwiiCMS/module/gallery/view/gallery/gallery.php

73 lines
2.4 KiB
PHP

<div class="row">
<div class="col2">
<?php echo template::button('galleryGalleryBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0),
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
</div>
<?php
$i = 1;
$picturesNb = count($module::$pictures);
foreach($module::$pictures as $picture => $legend):
// détermination des photos redimensionnées et originales
$photo = substr(strrchr($picture, '/'), 1);
$url_photo = str_replace($photo,'',$picture);
$photo_1280 = strpos($photo, 't1280.');
$original = str_replace('_t1280','',$photo);
$urloriginal = $url_photo.'backup/'.strtolower($original);
$urlback = (isset($urloriginal)) ? $urloriginal : 0;
if (file_exists($urloriginal)) {
$get_location = galleriesHelper::gps_exif($urloriginal);
}
else {
$get_location = galleriesHelper::gps_exif($picture);
}
?>
<?php if($i % 6 === 1): ?>
<div class="row">
<?php endif; ?>
<div class="col2 gallery">
<a href="<?php echo helper::baseUrl(false) . $picture; ?>" class="galleryGalleryPicture" data-caption="<?php echo $legend; ?>">
<img src="<?php echo helper::baseUrl(false) ?>module/gallery/vendor/thumbnailer.php?img=<?php echo $picture; ?>" alt="<?php echo $legend; ?>">
<?php if ($photo_1280 !== false): ?>
<div class="galleryGalleryName picResized" onclick="window.open('<?=helper::baseUrl(false).$urlback?>');" data-tippy-content="image originale">
<?php else: ?>
<div class="galleryGalleryName">
<?php endif;
if (!empty($legend)):
echo $legend;
// nettoyage et affichage du nom des images
else:
$separe = array('_','-','t1280');
$picname = str_replace($separe, ' ', $photo);
$picname = preg_replace('/(\.jpe?g|\.png|\.gif)$/i', '', $picname);
echo substr($picname,0,25);
endif;
?>
</div>
</a>
<?php
// ajout du marqueur aux images contenant des données exif gps
$data = (isset($get_location)) ? $get_location : NULL;
$lis = explode('¤',$data);
if ( ! isset($lis[1])) { $lis[1] = null; }
else {
$altitude = '';
if ((isset($lis[2])) && ($lis[2] > 0)) {
$alt = $lis[2];
}
?>
<div class="osm"><a href="<?=helper::baseUrl(false)?>module/gallery/vendor/map.php?lat=<?=$lis[0]?>&lon=<?=$lis[1]?>&alt=<?=$lis[2]?>&zoom=15" rel="data-lity" title="Géolocalisation"><img src="<?=helper::baseUrl(false)?>module/gallery/vendor/leaflet/images/marker-icon.png" style="width: 20px; height: auto;" alt="GPS"></a></div>
<?php } ?>
</div>
<?php if($i % 6 === 0 OR $i === $picturesNb): ?>
</div>
<?php
endif;
$i++;
endforeach;
?>