From 43a2bfba8339b4f5c72b8bfd7a7023d17facd7e0 Mon Sep 17 00:00:00 2001 From: Bruno21 Date: Wed, 16 Mar 2022 12:26:37 +0100 Subject: [PATCH] Add phtoswipe --- ce-mois.php | 691 ---- css/photoswipe.css | 416 +++ css/sls.css | 138 + functions.php | 191 ++ insert_bdd.php | 205 ++ js/photoswipe-lightbox.esm.js | 1154 +++++++ js/photoswipe-lightbox.esm.js.map | 1 + js/photoswipe.esm.js | 5192 +++++++++++++++++++++++++++++ js/photoswipe.esm.js.map | 1 + mois.php | 119 - photo-du-mois.php | 266 ++ 11 files changed, 7564 insertions(+), 810 deletions(-) delete mode 100644 ce-mois.php create mode 100644 css/photoswipe.css create mode 100644 css/sls.css create mode 100644 functions.php create mode 100644 insert_bdd.php create mode 100644 js/photoswipe-lightbox.esm.js create mode 100644 js/photoswipe-lightbox.esm.js.map create mode 100644 js/photoswipe.esm.js create mode 100644 js/photoswipe.esm.js.map delete mode 100644 mois.php create mode 100644 photo-du-mois.php diff --git a/ce-mois.php b/ce-mois.php deleted file mode 100644 index 8eae843..0000000 --- a/ce-mois.php +++ /dev/null @@ -1,691 +0,0 @@ - 'Français', 'en_US' => 'English' , 'de_DE' => 'German', 'es_ES' => 'Spanish' ); -$nation = array('fr_FR' => gettext('French'), 'en_US' => gettext('English') , 'de_DE' => gettext('German'), 'es_ES' => gettext('Spanish') ); -?> - - - - - - - - - - - -<?php echo gettext("Photo of the month..."); ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string 'Canon EOS 50D' (length=13) - //50D: 'DateTimeOriginal' => string '2009:12:05 12:42:33' (length=19) - - //'Model' => string 'Canon EOS 7D' (length=12) - //7D: DateTimeOriginal' => string '2010-02-20T15:07:05.24+01:00' (length=28) - - // -> 50D - if (!preg_match("/7D/", $apn)) { - $pieces = explode(' ', $date); - list($yy, $mm, $dd) = explode(':', $pieces[0]); - list($hh, $min, $ss) = explode(':', $pieces[1]); - } - // 7D - else { - $pieces = explode('T', $date); - list($yy, $mm, $dd) = explode('-', $pieces[0]); - $pieces_h = explode('.', $pieces[1]); - list($hh, $min, $ss) = explode(':', $pieces_h[0]); - } - $timestamp = mktime((int) $hh, (int) $min, (int) $ss, (int) $mm, (int) $dd, (int) $yy, '-1'); - $date = date('d.m.Y à H:i',$timestamp); - return $date; - } -function mois2 ($mois) { - switch ($mois) - { - case 00: - $mois = "00"; - break; - case 1: - $mois = gettext("January"); - break; - case 2: - $mois = gettext("February"); - break; - case 3: - $mois = gettext("March"); - break; - case 4: - $mois = gettext("April"); - break; - case 5: - $mois = gettext("May"); - break; - case 6: - $mois = gettext("June"); - break; - case 7: - $mois = gettext("July"); - break; - case 8: - $mois = gettext("August"); - break; - case 9: - $mois = gettext("September"); - break; - case 10: - $mois = gettext("October"); - break; - case 11: - $mois = gettext("November"); - break; - case 12: - $mois = gettext("December"); - break; - } - return $mois; - } - -function display ($filename,$album) { - $display = '
'. - '
' . - ''. - ''. - ''. - '
'. - ''. - '
'; - return $display; - } - -function displayRetina ($filename,$album) { - // 6_2012.jpg - // 4_2014_180_thumb.jpg 4_2014_360_thumb.jpg - $path = "../zenphoto/cache/" . $album . "/"; - $file = explode(".", $filename); - - //$a = $path . $filename; - //echo $a; - - - $file_sd = $path . $file[0] . "_180_thumb.jpg"; - $file_hd = $path . $file[0] . "_360_thumb.jpg"; - /* - $file_sd = $path . $file[0] . "_180_watermark.jpg"; - $file_hd = $path . $file[0] . "_360_watermark.jpg"; - */ - // - $th_sd = false; - $th_hd = false; - - if (file_exists($file_sd)) { - $th_sd = true; - $size_sd = getimagesize($file_sd, $info); - $thumb['sd'] = array( - 'url' => $file_sd, - 'width' => $size_sd[0], - 'height' => $size_sd[1] - ); - } - if (file_exists($file_hd)) { - $th_hd = true; - $size_hd = getimagesize($file_hd, $info); - $thumb['hd'] = array( - 'url' => $file_hd, - 'width' => $size_hd[0], - 'height' => $size_hd[1] - ); - } - //preprint($thumb); - - if (($th_sd == true) && ($th_hd == true)) { - $standard = $thumb['sd']['url'] . ', ' . $thumb['hd']['url'] . ' 2x'; - } - elseif ($th_sd == true) { - $standard = $thumb['sd']['url']; - } - elseif ($th_hd == true) { - $standard = $thumb['hd']['url'] . ' 2x'; - } - - $display = '
'; - $display .= ''; - $display .= ''; - $display .= '
'; - return $display; - } - -function get_image_title ($photo) { - $photo = '../zenphoto/albums/photos-du-mois/' . $photo; - $size = getimagesize($photo, $info); - if (isset($info["APP13"])) { - $iptc = iptcparse($info["APP13"]); - //print_r($iptc); - $caption = isset($iptc['2#120'][0]); - $graphic_name = isset($iptc['2#005'][0]); - } - return $caption; - } - -function date_archive ($chaine) { - $pieces = explode(".", $chaine); - $b = explode("_", $pieces[0]); - $mois = $b[0]; - $an = $b[1]; - $chaine = mois2($mois) . ' '. $an; - return $chaine; - } -function preprint($s, $return=false) { - $x = "
"; 
-        $x .= print_r($s, 1); 
-        $x .= "
"; - if ($return) return $x; - else print $x; - } -?> - - - - - - - -
- - - -
- -
-

- 1000) { - // HD - $hd = '../zenphoto/cache/photos-du-mois/' . substr($tableau[$i], 0, strlen($tableau[$i]) - 4) . "_FULL_watermark.jpg"; - if (file_exists($hd)) { - $size_hd = getimagesize($hd, $info_hd); - $imgs['img_hd'] = array( - 'url' => $hd, - 'width' => $size_hd[0], - 'height' => $size_hd[1] - ); - } - else { - $imgs['img_hd'] = array( - 'url' => $photo_du_mois, - 'width' => $size[0], - 'height' => $size[1] - ); - } - // SD - $sd = '../zenphoto/cache/photos-du-mois/' . substr($tableau[$i], 0, strlen($tableau[$i]) - 4) . "_800_watermark.jpg"; - if (file_exists($sd)) { - $size_sd = getimagesize($sd, $info_sd); - $imgs['img_sd'] = array( - 'url' => $sd, - 'width' => $size_sd[0], - 'height' => $size_sd[1] - ); - } - } - else { - // SD - $sd = '../zenphoto/cache/photos-du-mois/' . substr($tableau[$i], 0, strlen($tableau[$i]) - 4) . "_800_watermark.jpg"; - if (file_exists($sd)) { - $size_sd = getimagesize($sd, $info_sd); - $imgs['img_sd'] = array( - 'url' => $sd, - 'width' => $size_sd[0], - 'height' => $size_sd[1] - ); - } - $imgs['img_hd'] = array( - 'url' => "", - 'width' => "", - 'height' => "" - ); - } // if ($size[0] > 1000) - - $title = explode('.',$title); - $title = explode('_',$title[0]); - $title = mois2($title[0]) . ' ' . $title[1]; - $imgs['img_sd']['title'] = $title; - - if (isset($info["APP13"])) { - $iptc = iptcparse($info["APP13"]); - - if (isset($iptc['2#120'][0])) $legende = $iptc['2#120'][0]; - else $legende = ""; - if (isset($iptc['2#005'][0])) $titre = $iptc['2#005'][0]; - else $titre = ""; - - $keyword = ""; - if (isset($iptc['2#025'])) { - foreach ($iptc['2#025'] as $key => $val) { - $keyword .= ''; - $keyword .= ', '; - } - $keyword = substr($keyword, 0, -2); - } - - $imgs['img_sd']['legende'] = $legende; - $imgs['img_sd']['titre'] = $titre; - $imgs['img_sd']['keyword'] = $keyword; - } - - $exifInfo = ""; - $exif_array = read_exif_data_raw($file,0); - //$exifInfo = 'Le '.date('d.m.Y à H:i',strtotime($exif_array['SubIFD']['DateTimeOriginal'])).' - '; - $exifInfo = gettext("The") . " " .date(gettext("F j, Y, g:i a"),strtotime($exif_array['SubIFD']['DateTimeOriginal'])).' - '; - //$exifInfo .= $exif_array['SubIFD']['ExposureTime'].' à '.$exif_array['SubIFD']['FNumber'].' - ' .$exif_array['SubIFD']['ISOSpeedRatings'].' ISO - Focale '.$exif_array['SubIFD']['FocalLength']; - $exifInfo .= $exif_array['SubIFD']['ExposureTime']. gettext(" at ") .$exif_array['SubIFD']['FNumber'].' - ' .$exif_array['SubIFD']['ISOSpeedRatings'].' ISO - '. gettext("Focal ") .$exif_array['SubIFD']['FocalLength']; - //preprint($exif_array); - $imgs['img_sd']['exif'] = $exifInfo; - - break; - } - $i++; - } - //preprint($imgs); - - ?> - -
- - -

Titre

-

Légende

- - - - - - - - - - - - - '; - ?> - - - - -
- - -

Titre

-

Légende

- - -

- - -connect_error) { - trigger_error('Database connection failed: ' . $conn->connect_error, E_USER_ERROR); - exit(); - } - $conn->set_charset("utf8"); - - $excquery = "SELECT `id` FROM `" . $table['albums'] . "` WHERE `folder` = '" . $album . "'"; - - if ($result = $conn->query($excquery)) { - $result->data_seek(0); - $row = $result->fetch_row(); - $id_album = $row[0]; - $result->close(); - } - - $conn->close(); - - // Récupérer toutes les fichiers de l'album 'photos-du-mois' - - $conn = new mysqli($dbhost, $dbuser, $dbpassword, $zptable); - if ($conn->connect_error) { - trigger_error('Database connection failed: ' . $conn->connect_error, E_USER_ERROR); - exit(); - } - $conn->set_charset("utf8"); - - $pictquery = "SELECT `filename` FROM `" . $table['images'] . "` WHERE `albumid` = ? ORDER BY `date` DESC"; - - $stmt = $conn->prepare($pictquery); - //echo $pictquery; - if($stmt === false) { - trigger_error('Wrong SQL: ' . $pictquery . ' Error: ' . $conn->error, E_USER_ERROR); - } - else { - $stmt->bind_param('i', $id_album); - $stmt->execute(); - $stmt->bind_result($filename); - while ($stmt->fetch()) { - $fichier[] = $filename; - $i++; - //echo $filename; - } - } - $stmt->close(); - - // -?> - ? Utilisation: cliquer sur une vignette, puis....
"; -$aide .= " -sur ordinateur: naviguer avec les touches flèches droite et gauche, quitter avec ESC.
"; -$aide .= " -sur tablettes et smartphones: balayer l'écran avec un doigt vers la droite ou vers la gauche, ou naviguer avec les touches flèches droite et gauche. Cliquer sur la X pour quitter."; -?> - -
-

-

( ? )

- - -"; -echo $debut . "
"; -echo $fin . "
"; -echo $page . "
"; -*/ -for ($j=$debut; $j<=$fin; $j++) { -/* - if ($j <= count($fichier)-1) echo display($fichier[$j],$album); - if ($j+1 <= count($fichier)-1) echo display($fichier[$j+1],$album); - if ($j+2 <= count($fichier)-1) echo display($fichier[$j+2],$album); -*/ - if ($j <= count($fichier)-1) echo displayRetina($fichier[$j],$album); - if ($j+1 <= count($fichier)-1) echo displayRetina($fichier[$j+1],$album); - if ($j+2 <= count($fichier)-1) echo displayRetina($fichier[$j+2],$album); - - //echo $fichier[$j]; - - $j = $j + 2; - } -?> - -

- -= 2) echo '« '.gettext("prev").' '; -for ($i = 1; $i <= $nbpages; $i++) { - if ($i != $page) { - echo ''.$i.'  '; - } - else { - echo "".$i."  "; - } - } -if ($page < $nbpages) echo ''.gettext("next").' » '; - -?> - - -
- -
- -
-
- - -
- - -
- -
| " title=""> -
- - - diff --git a/css/photoswipe.css b/css/photoswipe.css new file mode 100644 index 0000000..92bde1d --- /dev/null +++ b/css/photoswipe.css @@ -0,0 +1,416 @@ +/*! PhotoSwipe main CSS by Dmytro Semenov | photoswipe.com */ + +.pswp { + --pswp-bg: #000; + --pswp-placeholder-bg: #222; + --pswp-error-text-color: #f7f7f7; + + --pswp-root-z-index: 100000; + + --pswp-preloader-color: rgba(79, 79, 79, 0.4); + --pswp-preloader-color-secondary: rgba(255, 255, 255, 0.9); + + /* defined via js: + --pswp-transition-duration: 333ms; */ + + --pswp-icon-color: #fff; + --pswp-icon-color-secondary: #4f4f4f; + --pswp-icon-stroke-color: #4f4f4f; + --pswp-icon-stroke-width: 2px; +} + + +/* + Styles for basic PhotoSwipe (pswp) functionality (sliding area, open/close transitions) +*/ + +.pswp { + position: fixed; + z-index: var(--pswp-root-z-index); + display: none; + touch-action: none; + outline: 0; + opacity: 0.003; + contain: layout style size; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} + +/* Prevents focus outline on the root element, + (it may be focused initially) */ +.pswp:focus { + outline: 0; +} + +.pswp * { + box-sizing: border-box; +} + +.pswp img { + max-width: none; +} + +.pswp--open { + display: block; +} + +.pswp, +.pswp__bg { + transform: translateZ(0); + will-change: opacity; +} + +.pswp__bg { + opacity: 0.005; + background: var(--pswp-bg); +} + +.pswp, +.pswp__scroll-wrap { + overflow: hidden; +} + +.pswp, +.pswp__scroll-wrap, +.pswp__bg, +.pswp__container, +.pswp__item, +.pswp__img, +.pswp__zoom-wrap { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.pswp { + position: fixed; +} + +.pswp__img, +.pswp__zoom-wrap { + width: auto; + height: auto; +} + +.pswp--click-to-zoom.pswp--zoom-allowed .pswp__img { + cursor: -webkit-zoom-in; + cursor: -moz-zoom-in; + cursor: zoom-in; +} + +.pswp--click-to-zoom.pswp--zoomed-in .pswp__img { + cursor: move; + cursor: -webkit-grab; + cursor: -moz-grab; + cursor: grab; +} + +.pswp--click-to-zoom.pswp--zoomed-in .pswp__img:active { + cursor: -webkit-grabbing; + cursor: -moz-grabbing; + cursor: grabbing; +} + +/* :active to override grabbing cursor */ +.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img, +.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img:active, +.pswp__img { + cursor: -webkit-zoom-out; + cursor: -moz-zoom-out; + cursor: zoom-out; +} + + +/* Prevent selection and tap highlights */ +.pswp__container, +.pswp__img, +.pswp__button { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.pswp__item { + /* z-index for fade transition */ + z-index: 1; + overflow: hidden; +} + +.pswp__hidden { + display: none !important; +} + + +/* + + PhotoSwipe UI + +*/ + +/* + Error message appears when image is not loaded + (JS option errorMsg controls markup) +*/ +.pswp__error-msg { + position: absolute; + top: 50%; + left: 0; + width: 100%; + padding: 0 10px; + margin-top: -0.5em; + font-size: 1em; + line-height: 1; + color: var(--pswp-error-text-color); + text-align: center; +} + +.pswp__error-msg a { + color: var(--pswp-error-text-color); + text-decoration: underline; +} + +/* +class pswp__hide-on-close is applied to elements that +should hide (for example fade out) when PhotoSwipe is closed +and show (for example fade in) when PhotoSwipe is opened + */ +.pswp .pswp__hide-on-close { + opacity: 0.005; + will-change: opacity; + transition: opacity var(--pswp-transition-duration) cubic-bezier(0.4, 0, 0.22, 1); + z-index: 10; /* always overlap slide content */ + pointer-events: none; /* hidden elements should not be clickable */ +} + +/* class pswp--ui-visible is added when opening or closing transition starts */ +.pswp--ui-visible .pswp__hide-on-close { + opacity: 1; + pointer-events: auto; +} + +/*