diff --git a/ce-mois.php b/ce-mois.php new file mode 100644 index 0000000..8eae843 --- /dev/null +++ b/ce-mois.php @@ -0,0 +1,691 @@ + '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 = '
'. + '
' . + ''. + ''. + ''. + '
'. + '
'. + ''. + ''.date_archive($filename).''. + '
'. + '
'; + 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 .= ''; + $display .= ''; + $display .= ''; + + //$display .= ''; + + $display .= ''; + $display .= ''; + $display .= ''; + + $display .= ''; + $display .= '
'; + $display .= '
'; + $display .= ''; + $display .= ''.date_archive($filename).''; + $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=""> +
+ + +