Add phtoswipe
This commit is contained in:
691
ce-mois.php
691
ce-mois.php
@@ -1,691 +0,0 @@
|
|||||||
<?php header("Content-type: text/html; charset=utf-8");
|
|
||||||
/*
|
|
||||||
ce-mois.php (thème Photoblog2)
|
|
||||||
v2 (10-05-2014): MySQLi - Retina(PictureFill) -
|
|
||||||
*/
|
|
||||||
$root = $_SERVER['DOCUMENT_ROOT'];
|
|
||||||
define('SERVERPATH',$root.'/zenphoto');
|
|
||||||
//define('WEBPATH','/'.basename(dirname(__FILE__)).'/zenphoto');
|
|
||||||
require_once(SERVERPATH.'/zp-core/template-functions.php');
|
|
||||||
//$host = 'http://' . $_SERVER['HTTP_HOST'];
|
|
||||||
if (isset($_SERVER['HTTPS'])) {
|
|
||||||
if ($_SERVER['HTTPS'] == 'on') $secure = 1;
|
|
||||||
else $secure = 0;
|
|
||||||
}
|
|
||||||
else $secure = 0;
|
|
||||||
|
|
||||||
$host = (($secure == 1) ? 'https' : "http") . '://' . $_SERVER['HTTP_HOST'];
|
|
||||||
//$host = (($_SERVER['HTTPS'] != "") ? "https" : "http") . '://' . $_SERVER['HTTP_HOST'];
|
|
||||||
|
|
||||||
include($root.'/lib2/localize.php');
|
|
||||||
$dir_locales = $root . '/locales';
|
|
||||||
|
|
||||||
$liste_locale = list_dir($dir_locales);
|
|
||||||
if ((!isset($_POST['lang'])) and (!isset($_GET['lang']))) $langue = locale_language_from_browser($myLanguages);
|
|
||||||
else $langue = $_REQUEST['lang'];
|
|
||||||
|
|
||||||
$domain = 'clicclac';
|
|
||||||
putenv('LC_ALL=' . $langue);
|
|
||||||
$loc = setlocale(LC_ALL, $langue);
|
|
||||||
bindtextdomain($domain, $root . '/locales/');
|
|
||||||
bind_textdomain_codeset($domain, 'UTF-8'); //nécessaire pour clicclac.info, pas pour macbook.local
|
|
||||||
textdomain($domain);
|
|
||||||
gettext("Enter");
|
|
||||||
//$nation = array('fr_FR' => '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') );
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head profile="http://gmpg.org/xfn/11">
|
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
||||||
<meta name="description" content="blabla" />
|
|
||||||
<meta name="keywords" content="Photo, oiseaux, paysages, nature, animaux, moto, superbike, motogp" />
|
|
||||||
<meta name="language" content="fr" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="robots" content="follow, all" />
|
|
||||||
|
|
||||||
<title><?php echo gettext("Photo of the month..."); ?></title>
|
|
||||||
|
|
||||||
<link rel="Shortcut Icon" href="<?php echo $host; ?>/photoblog/images/favicon.ico" type="image/x-icon" />
|
|
||||||
|
|
||||||
<link rel="alternate" type="application/rss+xml" title="Blog RSS 2.0" href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/?feed=rss2" />
|
|
||||||
<link rel="alternate" type="text/xml" title="Blog RSS .92" href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/?feed=rss" />
|
|
||||||
<link rel="alternate" type="application/atom+xml" title="Blog Atom 0.3" href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/?feed=atom" />
|
|
||||||
<link rel="alternate" type="application/rss+xml" title="RSS de la galerie" href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/zenphoto/rss.php" />
|
|
||||||
|
|
||||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
|
|
||||||
<script>document.cookie='resolution='+(Math.max(screen.width,screen.height)*("devicePixelRatio" in window ? devicePixelRatio : 1))+'; path=/';</script>
|
|
||||||
|
|
||||||
<!--link rel="stylesheet" href="http://<?php echo $_SERVER['HTTP_HOST'] . '/zenphoto/themes/photoblog/styles/photoblog.css'; ?>" type="text/css" /-->
|
|
||||||
<style type="text/css" media="screen">
|
|
||||||
<!-- @import url( <?php echo $host; ?>/wordpress/wp-content/themes/twentyten/style.css ); -->
|
|
||||||
<!-- @import url( <?php echo $host; ?>/wordpress/wp-content/themes/twentyten-child/style.css ); -->
|
|
||||||
<!-- @import url( <?php echo $host; ?>/photoblog/photoblog.css ); -->
|
|
||||||
</style>
|
|
||||||
<!–-[if lt IE 8]>
|
|
||||||
<!--link rel="stylesheet" type="text/css" href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/wordpress/wp-content/themes/twentyten-child/ie.css" /-->
|
|
||||||
<![endif]-–>
|
|
||||||
|
|
||||||
<!--link rel="stylesheet" type="text/css" href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/js/shadowbox-3/shadowbox.css">
|
|
||||||
<script type="text/javascript" src="http://<?php echo $_SERVER['HTTP_HOST']; ?>/js/shadowbox-3/shadowbox.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
Shadowbox.init({
|
|
||||||
language: "fr",
|
|
||||||
players: ["img,swf,flv,qt,wmp;iframe,html"],
|
|
||||||
animate: false,
|
|
||||||
slideshowDelay: 4,
|
|
||||||
initialWidth: 800,
|
|
||||||
initialHeight: 600,
|
|
||||||
counterType: 'skip',
|
|
||||||
counterLimit: 12,
|
|
||||||
handleUnsupported: 'remove'
|
|
||||||
});
|
|
||||||
</script-->
|
|
||||||
<!-- http://osvaldas.info/elegant-css-and-jquery-tooltip-responsive-mobile-friendly -->
|
|
||||||
<script src="js/tooltip.js"></script>
|
|
||||||
<!-- SwipeBox http://brutaldesign.github.io/swipebox/
|
|
||||||
Voir aussi FancyBox 3 http://fancyapps.com/fancybox/beta/
|
|
||||||
-->
|
|
||||||
<script src="js/swipebox/jquery.swipebox.js"></script>
|
|
||||||
<link rel="stylesheet" href="js/swipebox/swipebox.css">
|
|
||||||
<script type="text/javascript">
|
|
||||||
/**/
|
|
||||||
jQuery(function($) {
|
|
||||||
$(".swipebox").swipebox({
|
|
||||||
hideBarsDelay : 3000 // 0 to always show caption and action bar
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
/*found on http://www.brunildo.org/test/img_center.html*/
|
|
||||||
.wraptocenter {
|
|
||||||
display: table-cell!important;
|
|
||||||
text-align: center!important;
|
|
||||||
vertical-align: middle!important;
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
}
|
|
||||||
.wraptocenter * {
|
|
||||||
vertical-align: middle!important;
|
|
||||||
}
|
|
||||||
/*\*//*/
|
|
||||||
.wraptocenter {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.wraptocenter span {
|
|
||||||
display: inline-block;
|
|
||||||
height: 100%;
|
|
||||||
width: 1px;
|
|
||||||
}
|
|
||||||
/**/
|
|
||||||
</style>
|
|
||||||
<!--[if IE]><style>
|
|
||||||
.wraptocenter span {
|
|
||||||
display: inline-block;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
</style><![endif]-->
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
include('exifer/exif.php');
|
|
||||||
|
|
||||||
function exif_date($date,$apn) {
|
|
||||||
//'Model' => 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 = '<div class="album">'.
|
|
||||||
'<div class="thumb">' .
|
|
||||||
'<a href="../zenphoto/albums/'.$album.'/'.$filename.'" title="'.date_archive($filename).'" class="wraptocenter swipebox" />'.
|
|
||||||
'<img src="../zenphoto/zp-core/i.php?a='.$album.'&i='.$filename.'&s=180" class="img_archive" />'.
|
|
||||||
'</a>'.
|
|
||||||
'</div>'.
|
|
||||||
'<div class="albumdesc">'.
|
|
||||||
'<a href="../zenphoto/index.php?album='.$album.'&image='.$filename.'" title= "'.date_archive($filename).'" class="" />'.
|
|
||||||
'<span class="exif">'.date_archive($filename).'</span>'.
|
|
||||||
'</a></div>'.
|
|
||||||
'</div>';
|
|
||||||
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 = '<div class="album">';
|
|
||||||
$display .= '<div class="thumb">';
|
|
||||||
$display .= '<a href="../zenphoto/albums/'.$album.'/'.$filename.'" title="'.date_archive($filename).'" class="wraptocenter swipebox" />';
|
|
||||||
|
|
||||||
$display .= '<picture data-picture data-alt="">';
|
|
||||||
$display .= '<!--[if IE 9]><video style="display: none;"><![endif]-->';
|
|
||||||
$display .= '<source class="image_standard" srcset="' . $standard . '">';
|
|
||||||
|
|
||||||
//$display .= '<img src="../zenphoto/zp-core/i.php?a='.$album.'&i='.$filename.'&s=180" class="img_archive" />';
|
|
||||||
|
|
||||||
$display .= '<!--[if IE 9]></video><![endif]-->';
|
|
||||||
$display .= '<img srcset="' . $thumb['sd']['url'] . '" width="' . $thumb['sd']['width'] . '" height="' . $thumb['sd']['height'] . '"alt="">';
|
|
||||||
$display .= '</picture>';
|
|
||||||
|
|
||||||
$display .= '</a>';
|
|
||||||
$display .= '</div>';
|
|
||||||
$display .= '<div class="albumdesc">';
|
|
||||||
$display .= '<a href="../zenphoto/index.php?album='.$album.'&image='.$filename.'" title= "'.date_archive($filename).'" class="" />';
|
|
||||||
$display .= '<span class="exif">'.date_archive($filename).'</span>';
|
|
||||||
$display .= '</a></div>';
|
|
||||||
$display .= '</div>';
|
|
||||||
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 = "<pre>";
|
|
||||||
$x .= print_r($s, 1);
|
|
||||||
$x .= "</pre>";
|
|
||||||
if ($return) return $x;
|
|
||||||
else print $x;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<script>
|
|
||||||
// Picture element HTML5 shiv
|
|
||||||
document.createElement( "picture" );
|
|
||||||
</script>
|
|
||||||
<script src="<?php echo $host; ?>/photoblog/js/picturefill.min.js" async></script>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class="now">
|
|
||||||
|
|
||||||
<div id="wrapper">
|
|
||||||
|
|
||||||
<div id="header">
|
|
||||||
<div id="logo">
|
|
||||||
<div id="site-name">
|
|
||||||
<a href="index.php" title="ClicClac.info" rel="home">ClicClac.info</a>
|
|
||||||
</div>
|
|
||||||
<div id="site-description"><?php echo gettext("Now"); ?></div>
|
|
||||||
</div>
|
|
||||||
<div id="pagenav">
|
|
||||||
<ul id="menu-principal" class="menu">
|
|
||||||
|
|
||||||
<li><a href="ce-mois.php"><?php echo gettext("Now"); ?></a></li>
|
|
||||||
<li><a href="/wordpress/"><?php echo gettext("Blog"); ?></a></li>
|
|
||||||
<li><a href="/zenphoto/"><?php echo gettext("Gallery"); ?></a></li>
|
|
||||||
<li><a href="/wordpress/livre_d-or/"><?php echo gettext("Guestbook"); ?></a></li>
|
|
||||||
<li><a href="/wordpress/contact/"><?php echo gettext("Contact"); ?></a></li>
|
|
||||||
<li><a href="/wordpress/liens/"><?php echo gettext("Links"); ?></a></li>
|
|
||||||
|
|
||||||
<!--En ce moment, Blog, Portfolio, Livre d’Or, Contact, Liens -->
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div> <!-- /header -->
|
|
||||||
|
|
||||||
<div id="main">
|
|
||||||
|
|
||||||
<div id="padbox">
|
|
||||||
<h2><?php echo gettext("Photo of the month..."); ?></h2>
|
|
||||||
<?php
|
|
||||||
$mois = date('n');
|
|
||||||
$an = date('Y');
|
|
||||||
$image = $mois . '_' . $an . '.jpg';
|
|
||||||
$annee = $an;
|
|
||||||
|
|
||||||
// nom des fichiers: 7_2009.jpg et non pas 07_2009.jpg
|
|
||||||
|
|
||||||
for ($i = 0; $i <= 11 ; $i++) {
|
|
||||||
$a = ($mois - $i);
|
|
||||||
if ($a < 1) {
|
|
||||||
$a = (12 + $a);
|
|
||||||
$annee = $an - 1;
|
|
||||||
}
|
|
||||||
$tableau[$i] = $a . '_' . $annee . '.jpg';
|
|
||||||
}
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
while ($i < 13) {
|
|
||||||
$file = '../zenphoto/albums/photos-du-mois/' . $tableau[$i];
|
|
||||||
//echo $file;
|
|
||||||
|
|
||||||
if (file_exists($file)) {
|
|
||||||
//echo $file;
|
|
||||||
// ../zenphoto/albums/photos-du-mois/4_2014.jpg
|
|
||||||
// 4_2014_800_watermark.jpg, 4_2014_FULL_watermark.jpg
|
|
||||||
$photo_du_mois = $file;
|
|
||||||
$title = $tableau[$i];
|
|
||||||
|
|
||||||
$size = getimagesize($photo_du_mois, $info);
|
|
||||||
|
|
||||||
if ($size[0] > 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 .= '<a href="' . $host . '/zenphoto/index.php?p=search&words=' . $val . '" title="Tag > ' . $val . '" rel="tag">' . $val . '</a>';
|
|
||||||
$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);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="cadre">
|
|
||||||
|
|
||||||
<?php if (($imgs['img_sd']['titre'] != "") || ($imgs['img_sd']['legende'] != "")) { ?>
|
|
||||||
<p class="titrePhoto"><?php echo $imgs['img_sd']['titre']; ?>Titre</p>
|
|
||||||
<p class="legendePhoto"><?php echo $imgs['img_sd']['legende']; ?>Légende</p>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<!--img src="watermark2.php?src=<?php echo $photo_du_mois; ?>" alt="Image du mois" title="<?php echo $title; ?>" <?php echo $size[3]; ?> /-->
|
|
||||||
|
|
||||||
<!-- Retina -->
|
|
||||||
<?php
|
|
||||||
if (($imgs['img_sd']['url'] != "") && ($imgs['img_hd']['url'] != "")) {
|
|
||||||
$standard_source = $imgs['img_sd']['url'] . ', ' . $imgs['img_hd']['url'] . ' 2x';
|
|
||||||
//echo "1";
|
|
||||||
}
|
|
||||||
else if ($imgs['img_sd']['url'] != "") {
|
|
||||||
$standard_source = $imgs['img_sd']['url'];
|
|
||||||
//echo "2";
|
|
||||||
}
|
|
||||||
else if ($imgs['img_hd']['url'] != "") {
|
|
||||||
$standard_source = $imgs['img_hd']['url'] . ' 2x';
|
|
||||||
//echo "3";
|
|
||||||
}
|
|
||||||
//echo $standard_source;
|
|
||||||
?>
|
|
||||||
|
|
||||||
<picture data-picture data-alt="">
|
|
||||||
<!--[if IE 9]><video style="display: none;"><![endif]-->
|
|
||||||
<source class="image_standard" srcset="<?php echo $standard_source; ?>">
|
|
||||||
<!--source class="image_medium" srcset="" media="(max-width: 767px)">
|
|
||||||
<source class="image_small" srcset="" media="(max-width: 767px)"-->
|
|
||||||
<!--[if IE 9]></video><![endif]-->
|
|
||||||
<?php
|
|
||||||
echo '<img srcset="' . $imgs['img_sd']['url'] . '" alt="" width="'. $imgs['img_sd']['width'] . '" height="'. $imgs['img_sd']['height'] .'" />';
|
|
||||||
?>
|
|
||||||
</picture>
|
|
||||||
|
|
||||||
<!-- /Retina -->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if (($imgs['img_sd']['titre'] != "") || ($imgs['img_sd']['legende'] != "")) { ?>
|
|
||||||
<p class="titrePhoto"><?php echo $imgs['img_sd']['titre']; ?>Titre</p>
|
|
||||||
<p class="legendePhoto"><?php echo $imgs['img_sd']['legende']; ?>Légende</p>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<p class="exifs"><?php echo $imgs['img_sd']['exif']; ?></p>
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
require_once($_SERVER['DOCUMENT_ROOT'].'/Connections/cnx.php');
|
|
||||||
|
|
||||||
$album = 'photos-du-mois'; //Photos du mois
|
|
||||||
$table = array();
|
|
||||||
if ($_SERVER['HTTP_HOST'] == "macbook-pro.local") {
|
|
||||||
$table['images'] = ".images";
|
|
||||||
$table['albums'] = ".albums";
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if ($_SERVER['HTTP_HOST'] == "clicclac.info") {
|
|
||||||
$table['images'] = "zp_images";
|
|
||||||
$table['albums'] = "zp_albums";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (($_SERVER['HTTP_HOST'] == "www.funnymac.com") || ($_SERVER['HTTP_HOST'] == "clicclac.info")) {
|
|
||||||
$table['images'] = "zenphoto_images";
|
|
||||||
$table['albums'] = "zenphoto_albums";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Récupérer l'ID de l'album 'photos-du-mois'
|
|
||||||
$i = 0;
|
|
||||||
$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");
|
|
||||||
|
|
||||||
$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();
|
|
||||||
|
|
||||||
//
|
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
$aide = "<span class='aide'> ? </span><b>Utilisation:</b> cliquer sur une vignette, puis....<br />";
|
|
||||||
$aide .= " <b><i>-sur ordinateur:</i></b> naviguer avec les touches flèches droite et gauche, quitter avec ESC.<br />";
|
|
||||||
$aide .= " <b><i>-sur tablettes et smartphones:</i></b> 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.";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div id="archive">
|
|
||||||
<p style="clear: both; "></p>
|
|
||||||
<h4><?php echo gettext("Archives"); ?> (<abbr title="<?php echo $aide; ?>" rel="tooltip"> ? </abbr>)</h4>
|
|
||||||
<!--h4><?php echo gettext("Archives"); ?> <span class='aide'><a href="#" title="<?php echo $aide; ?>" class="tooltip"><span title="<?php echo gettext("Help"); ?>">( ? )</span></a></span></h4-->
|
|
||||||
|
|
||||||
<?php
|
|
||||||
//nb d'archive par page
|
|
||||||
$nb = 12;
|
|
||||||
|
|
||||||
if (!isset($_GET['page'])) $page = 1;
|
|
||||||
// sinon on recupere la valeur numerique recue en paramètre
|
|
||||||
else $page = intval($_GET['page']);
|
|
||||||
|
|
||||||
// on determine debut du limit
|
|
||||||
$debut = (($page - 1) * $nb) +1; // page 1: 2, page 2: 14, page 3: 26
|
|
||||||
$fin = ($debut + $nb) - 1;
|
|
||||||
/*
|
|
||||||
echo count($fichier) . "<br>";
|
|
||||||
echo $debut . "<br>";
|
|
||||||
echo $fin . "<br>";
|
|
||||||
echo $page . "<br>";
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<p style="clear: both; "></p>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// calcul du nombre de pages (arrondi a l'entier superieur)
|
|
||||||
$nbpages = ceil(count($fichier) / 12);
|
|
||||||
$prec = $page - 1;
|
|
||||||
$suiv = $page + 1;
|
|
||||||
|
|
||||||
if ($page >= 2) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$prec.'" title="'.gettext("Previous Page").'">« '.gettext("prev").'</a> ';
|
|
||||||
for ($i = 1; $i <= $nbpages; $i++) {
|
|
||||||
if ($i != $page) {
|
|
||||||
echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$i.'" title="'.gettext("Page").' '.$i.'">'.$i.' </a> ';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "<span class='gras'>".$i."</span> ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($page < $nbpages) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$suiv.'" title="'.gettext("Next Page").'">'.gettext("next").' »</a> ';
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div> <!-- wrapper -->
|
|
||||||
|
|
||||||
|
|
||||||
<div id="credit">
|
|
||||||
<?php
|
|
||||||
$host = $_SERVER["HTTP_HOST"];
|
|
||||||
//if (($host == "macbook.local") or ($host == "localhost")) $license = "?page_id=122";
|
|
||||||
//if ($host == "clicclac.info") $license = "license-des-photos";
|
|
||||||
$license = "license-des-photos";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div id="choose_lang">
|
|
||||||
<?php echo choose_lang(gettext('Select language'),$liste_locale, $get=0, $post=-1); ?>
|
|
||||||
</div>
|
|
||||||
© <?php echo $_SERVER['HTTP_HOST']; ?> | <a href="http://<?php echo $_SERVER["HTTP_HOST"] . '/wordpress/' . $license; ?>" title="<?php echo gettext("Photo's licence"); ?>"><?php echo gettext("Photo's licence"); ?></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
416
css/photoswipe.css
Normal file
416
css/photoswipe.css
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* <button> styles, including css reset */
|
||||||
|
.pswp__button {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
width: 50px;
|
||||||
|
height: 60px;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
background: none;
|
||||||
|
border: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
opacity: 0.85;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__button:hover,
|
||||||
|
.pswp__button:active,
|
||||||
|
.pswp__button:focus {
|
||||||
|
transition: none;
|
||||||
|
padding: 0;
|
||||||
|
background: none;
|
||||||
|
border: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__button:disabled {
|
||||||
|
opacity: 0.3;
|
||||||
|
cursor: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__icn {
|
||||||
|
fill: var(--pswp-icon-color);
|
||||||
|
color: var(--pswp-icon-color-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__icn {
|
||||||
|
position: absolute;
|
||||||
|
top: 14px;
|
||||||
|
left: 9px;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__icn-shadow {
|
||||||
|
stroke: var(--pswp-icon-stroke-color);
|
||||||
|
stroke-width: var(--pswp-icon-stroke-width);
|
||||||
|
fill: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__icn:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
div element that matches size of large image,
|
||||||
|
large image loads on top of it,
|
||||||
|
used when msrc is not provided
|
||||||
|
*/
|
||||||
|
div.pswp__img--placeholder,
|
||||||
|
.pswp__img--with-bg {
|
||||||
|
background: var(--pswp-placeholder-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__top-bar {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 60px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-end;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
/* allow events to pass through top bar itself */
|
||||||
|
pointer-events: none !important;
|
||||||
|
}
|
||||||
|
.pswp__top-bar > * {
|
||||||
|
pointer-events: auto;
|
||||||
|
/* this makes transition significantly more smooth,
|
||||||
|
even though inner elements are not animated */
|
||||||
|
will-change: opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Close button
|
||||||
|
|
||||||
|
*/
|
||||||
|
.pswp__button--close {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Arrow buttons
|
||||||
|
|
||||||
|
*/
|
||||||
|
.pswp__button--arrow {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 75px;
|
||||||
|
height: 100px;
|
||||||
|
top: 50%;
|
||||||
|
margin-top: -50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__button--arrow:disabled {
|
||||||
|
display: none;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__button--arrow .pswp__icn {
|
||||||
|
top: 50%;
|
||||||
|
margin-top: -30px;
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
background: none;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp--one-slide .pswp__button--arrow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* hide arrows on touch screens */
|
||||||
|
.pswp--touch .pswp__button--arrow {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* show arrows only after mouse was used */
|
||||||
|
.pswp--has_mouse .pswp__button--arrow {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__button--arrow--prev {
|
||||||
|
right: auto;
|
||||||
|
left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__button--arrow--next {
|
||||||
|
right: 0px;
|
||||||
|
}
|
||||||
|
.pswp__button--arrow--next .pswp__icn {
|
||||||
|
left: auto;
|
||||||
|
right: 14px;
|
||||||
|
/* flip horizontally */
|
||||||
|
transform: scale(-1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Zoom button
|
||||||
|
|
||||||
|
*/
|
||||||
|
.pswp__button--zoom {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp--zoom-allowed .pswp__button--zoom {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* "+" => "-" */
|
||||||
|
.pswp--zoomed-in .pswp__zoom-icn-bar-v {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Loading indicator
|
||||||
|
|
||||||
|
*/
|
||||||
|
.pswp__preloader {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
width: 50px;
|
||||||
|
height: 60px;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__preloader .pswp__icn {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s linear;
|
||||||
|
animation: pswp-clockwise 600ms linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__preloader--active .pswp__icn {
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pswp-clockwise {
|
||||||
|
0% { transform: rotate(0deg); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
"1 of 10" counter
|
||||||
|
|
||||||
|
*/
|
||||||
|
.pswp__counter {
|
||||||
|
height: 30px;
|
||||||
|
margin: 15px 0 0 20px;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 30px;
|
||||||
|
color: var(--pswp-icon-color);
|
||||||
|
text-shadow: 1px 1px 3px var(--pswp-icon-color-secondary);
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp--one-slide .pswp__counter {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
138
css/sls.css
Normal file
138
css/sls.css
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300&display=swap');
|
||||||
|
|
||||||
|
h1,
|
||||||
|
p {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
The grid itself needs only 4 CSS declarations:
|
||||||
|
*/
|
||||||
|
|
||||||
|
.myGallery {
|
||||||
|
display: grid;
|
||||||
|
grid-gap: 10px;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
.myGallery img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
And here are some declarations for the image caption.
|
||||||
|
Just hover over one of the last 5 images to see it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.myGallery .item {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myGallery .item img {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myGallery .caption {
|
||||||
|
margin: 0;
|
||||||
|
padding: 1em;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
text-align: center;
|
||||||
|
overflow: auto;
|
||||||
|
box-sizing: border-box;
|
||||||
|
transition: transform 0.5s;
|
||||||
|
transform: translateY(100%);
|
||||||
|
background: rgba(0, 0, 0, 0.7);
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 1.2em
|
||||||
|
/*font: Ubuntu, sans-serif;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.myGallery .item:hover .caption {
|
||||||
|
transform: translateY(0%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.myGallery .item:hover {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pswp__custom-caption {
|
||||||
|
background: rgba(75, 75, 75, 0.50);
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #fff;
|
||||||
|
width: calc(100% - 32px);
|
||||||
|
max-width: 400px;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
bottom: 16px;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
.pswp__custom-caption a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.hidden-caption-content {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trois {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
width: auto\9; /* ie8 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.cadre {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
max-width:800px;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exif {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
max-width:800px;
|
||||||
|
margin-bottom: 4rem;
|
||||||
|
text-align: center;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 0.75em
|
||||||
|
}
|
||||||
|
|
||||||
|
.navPage {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-top: 4rem;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 1em
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
The rest is only styling for this example page
|
||||||
|
|
||||||
|
|
||||||
|
@import url("https://fonts.googleapis.com/css2?family=Vollkorn:wght@400;900&display=swap");
|
||||||
|
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300&display=swap');
|
||||||
|
body {
|
||||||
|
font: 400 1.5em/1.58 Vollkorn, serif;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
.myGallery {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
191
functions.php
Normal file
191
functions.php
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* Fonction month(): convertit le mois (nb) en mois (texte) francais
|
||||||
|
|
||||||
|
photo-du-mois.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
function month($w) {
|
||||||
|
//setlocale(LC_TIME, 'fr_FR');
|
||||||
|
$m = date('m', strtotime($w)); // month
|
||||||
|
$y = date('Y', strtotime($w)); // year
|
||||||
|
//echo $m . "-" . $y;
|
||||||
|
|
||||||
|
// or any other locales like pl_PL, cs_CZ, fr_FR, zh, zh_Hans, ...
|
||||||
|
$locale = 'fr_FR';
|
||||||
|
$dateFormatter = new IntlDateFormatter(
|
||||||
|
$locale,
|
||||||
|
IntlDateFormatter::LONG, // date type
|
||||||
|
IntlDateFormatter::NONE // time type
|
||||||
|
);
|
||||||
|
$dateFormatter->setPattern('LLLL'); // full month name with NO DECLENSION ;-)
|
||||||
|
$months_locale = [];
|
||||||
|
for ($month_number = 1; $month_number <= 12; ++$month_number) {
|
||||||
|
$months_locale[] = $dateFormatter->format(
|
||||||
|
// 'n' => month number with no leading zeros
|
||||||
|
DateTime::createFromFormat('n', (string)$month_number)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$my = ucfirst($months_locale[(int)$m]) . " " . $y;
|
||||||
|
//echo $my;
|
||||||
|
return $my;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Fonctions get_gps() et gps2Num(): extrait les coord GPS depuis les exifs
|
||||||
|
|
||||||
|
insert_bdd.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
function gps2Num($coordPart){
|
||||||
|
$parts = explode('/', $coordPart);
|
||||||
|
if(count($parts) <= 0)
|
||||||
|
return 0;
|
||||||
|
if(count($parts) == 1)
|
||||||
|
return $parts[0];
|
||||||
|
return floatval($parts[0]) / floatval($parts[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_gps($exif) {
|
||||||
|
if($exif && isset($exif['GPS'])){
|
||||||
|
$GPSLatitudeRef = isset($exif['GPS']['GPSLatitudeRef']) ? $exif['GPS']['GPSLatitudeRef'] : '';
|
||||||
|
$GPSLatitude = isset($exif['GPS']['GPSLatitude']) ? $exif['GPS']['GPSLatitude'] : '';
|
||||||
|
$GPSLongitudeRef = isset($exif['GPS']['GPSLongitudeRef']) ? $exif['GPS']['GPSLongitudeRef'] : '';
|
||||||
|
$GPSLongitude = isset($exif['GPS']['GPSLongitude']) ? $exif['GPS']['GPSLongitude'] : '';
|
||||||
|
$GPSAltitude = isset($exif['GPS']['GPSAltitude']) ? $exif['GPS']['GPSAltitude'] : '';
|
||||||
|
|
||||||
|
$lat_degrees = count($GPSLatitude) > 0 ? gps2Num($GPSLatitude[0]) : 0;
|
||||||
|
$lat_minutes = count($GPSLatitude) > 1 ? gps2Num($GPSLatitude[1]) : 0;
|
||||||
|
$lat_seconds = count($GPSLatitude) > 2 ? gps2Num($GPSLatitude[2]) : 0;
|
||||||
|
|
||||||
|
$lon_degrees = count($GPSLongitude) > 0 ? gps2Num($GPSLongitude[0]) : 0;
|
||||||
|
$lon_minutes = count($GPSLongitude) > 1 ? gps2Num($GPSLongitude[1]) : 0;
|
||||||
|
$lon_seconds = count($GPSLongitude) > 2 ? gps2Num($GPSLongitude[2]) : 0;
|
||||||
|
|
||||||
|
$lat_direction = ($GPSLatitudeRef == 'W' or $GPSLatitudeRef == 'S') ? -1 : 1;
|
||||||
|
$lon_direction = ($GPSLongitudeRef == 'W' or $GPSLongitudeRef == 'S') ? -1 : 1;
|
||||||
|
|
||||||
|
$latitude = $lat_direction * ($lat_degrees + ($lat_minutes / 60) + ($lat_seconds / (60*60)));
|
||||||
|
$longitude = $lon_direction * ($lon_degrees + ($lon_minutes / 60) + ($lon_seconds / (60*60)));
|
||||||
|
|
||||||
|
$alt = explode('/', $exif['GPS']["GPSAltitude"]);
|
||||||
|
$altitude = (isset($alt[1])) ? ($alt[0] / $alt[1]) : $alt[0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$latitude = '';
|
||||||
|
$longitude = '';
|
||||||
|
$altitude = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return array('latitude'=>$latitude, 'longitude'=>$longitude, 'altitude'=>$altitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Fonction create_thumb(): Création des vigntettes
|
||||||
|
|
||||||
|
insert_bdd.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
function create_thumb($thumb_w, $thumb_h, $image) {
|
||||||
|
|
||||||
|
list($origin_w, $origin_h) = getimagesize($image);
|
||||||
|
$origin_ratio = round($origin_w / $origin_h, 1);
|
||||||
|
$outFile = str_replace("photos/img", "photos/thumb", $image);
|
||||||
|
|
||||||
|
if ($origin_w != null && $origin_h != null) {
|
||||||
|
if ($thumb_w / $thumb_h > $origin_ratio) {
|
||||||
|
$thumb_w = $thumb_h * $origin_ratio;
|
||||||
|
} else {
|
||||||
|
$thumb_h = $thumb_w / $origin_ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($origin_w >= 400 && $origin_h >= 400) {
|
||||||
|
$image = new Imagick($image); // !!!
|
||||||
|
$image->thumbnailImage($thumb_w, $thumb_h);
|
||||||
|
$image->writeImage($outFile);
|
||||||
|
$image->destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Fonction in_bdd(): test si la photo est déjà dans la bdd
|
||||||
|
|
||||||
|
insert_bdd.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
function in_bdd($image) {
|
||||||
|
try {
|
||||||
|
$conn3 = new PDO('sqlite:db_photo.sqlite3');
|
||||||
|
#$query3 = "SELECT filename FROM photos WHERE instr(filename, '". $file . "') > 0;";
|
||||||
|
$query3 = "SELECT filename FROM photos WHERE filename = :filename";
|
||||||
|
$stmt = $conn3->prepare($query3);
|
||||||
|
$stmt->bindParam(':filename', $image, PDO::PARAM_STR);
|
||||||
|
|
||||||
|
$stmt->execute();
|
||||||
|
$result3 = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
if (count($result3) > 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$conn3 = null;
|
||||||
|
}
|
||||||
|
catch(PDOException $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
function _pr($d) {
|
||||||
|
echo "<div style='border: 1px solid#ccc; padding: 10px;'>";
|
||||||
|
echo '<strong>' . debug_backtrace()[0]['file'] . ' ' . debug_backtrace()[0]['line'] . '</strong>';
|
||||||
|
echo "</div>";
|
||||||
|
echo '<pre>';
|
||||||
|
if(is_array($d)) {
|
||||||
|
print_r($d);
|
||||||
|
} else if(is_object($d)) {
|
||||||
|
var_dump($d);
|
||||||
|
}
|
||||||
|
echo '</pre>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* return geo exif in a nice form
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
function geo_frac2dec($str) {
|
||||||
|
@list( $n, $d ) = explode( '/', $str );
|
||||||
|
if ( !empty($d) )
|
||||||
|
return $n / $d;
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
33° 52.37′ 0″ S 151° 9.06′ 0″ E
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function geo_pretty_fracs2dec($fracs) {
|
||||||
|
return geo_frac2dec($fracs[0]) . '° ' .
|
||||||
|
geo_frac2dec($fracs[1]) . '′ ' .
|
||||||
|
geo_frac2dec($fracs[2]) . '″ ';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
to GoogleMaps
|
||||||
|
*/
|
||||||
|
|
||||||
|
function geo_single_fracs2dec($fracs) {
|
||||||
|
return geo_frac2dec($fracs[0]) +
|
||||||
|
geo_frac2dec($fracs[1]) / 60 +
|
||||||
|
geo_frac2dec($fracs[2]) / 3600;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
205
insert_bdd.php
Normal file
205
insert_bdd.php
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
include 'functions.php';
|
||||||
|
|
||||||
|
$base = 'db_photo.sqlite3';
|
||||||
|
|
||||||
|
// Taille des vignettes
|
||||||
|
$th_w = 300;
|
||||||
|
$th_h = 300;
|
||||||
|
|
||||||
|
//Get a list of file paths using the glob function.
|
||||||
|
$fileList = glob('photos/img/*');
|
||||||
|
|
||||||
|
// Création de la base et de la table photos
|
||||||
|
$conn = new PDO("sqlite:db_photo.sqlite3");
|
||||||
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
$query = "CREATE TABLE IF NOT EXISTS photos (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
filename TEXT NOT NULL,
|
||||||
|
date TEXT,
|
||||||
|
lens TEXT,
|
||||||
|
exposure INTEGER,
|
||||||
|
iso INTEGER,
|
||||||
|
width INTEGER,
|
||||||
|
height INTEGER,
|
||||||
|
html TEXT,
|
||||||
|
aperture TEXT,
|
||||||
|
model TEXT,
|
||||||
|
lat REAL,
|
||||||
|
long REAL,
|
||||||
|
alt REAL,
|
||||||
|
legende TEXT,
|
||||||
|
copyright TEXT,
|
||||||
|
titre TEXT,
|
||||||
|
createur TEXTr,
|
||||||
|
keywords TEXT,
|
||||||
|
UNIQUE(filename)
|
||||||
|
)";
|
||||||
|
$conn->exec($query);
|
||||||
|
$conn = null;
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
|
||||||
|
// Ajout de données dans la table
|
||||||
|
foreach($fileList as $file){
|
||||||
|
|
||||||
|
$x = in_bdd($file);
|
||||||
|
|
||||||
|
if ($x == false) { //false
|
||||||
|
|
||||||
|
if ($exif = @exif_read_data($file, 0, true )) {
|
||||||
|
|
||||||
|
//_pr($exif);
|
||||||
|
# YYYY-MM-DD HH:MM:SS.SSS - 2019:10:01 14:03:12
|
||||||
|
$da = isset($exif['EXIF']['DateTimeOriginal']) ? $exif['EXIF']['DateTimeOriginal'] : '';
|
||||||
|
$obj = isset($exif['EXIF']['UndefinedTag:0xA434']) ? $exif['EXIF']['UndefinedTag:0xA434'] : '';
|
||||||
|
$ex = isset($exif['EXIF']['ExposureTime']) ? $exif['EXIF']['ExposureTime'] : '';
|
||||||
|
$iso = isset($exif['EXIF']['ISOSpeedRatings']) ? $exif['EXIF']['ISOSpeedRatings'] : '';
|
||||||
|
|
||||||
|
$wi = isset($exif['COMPUTED']['Width']) ? $exif['COMPUTED']['Width'] : '';
|
||||||
|
$he = isset($exif['COMPUTED']['Height']) ? $exif['COMPUTED']['Height'] : '';
|
||||||
|
$ht = isset($exif['COMPUTED']['html']) ? $exif['COMPUTED']['html'] : '';
|
||||||
|
$ap = isset($exif['COMPUTED']['ApertureFNumber']) ? $exif['COMPUTED']['ApertureFNumber'] : '';
|
||||||
|
|
||||||
|
$mod = isset($exif['IFD0']['Model']) ? $exif['IFD0']['Model'] : '';
|
||||||
|
|
||||||
|
$gps = get_gps($exif);
|
||||||
|
|
||||||
|
$photos[$i] = array(
|
||||||
|
'filename' => $file,
|
||||||
|
|
||||||
|
'date' => $da,
|
||||||
|
'lens' => $obj,
|
||||||
|
'exposure' => $ex,
|
||||||
|
'iso' => $iso,
|
||||||
|
|
||||||
|
'width' => $wi,
|
||||||
|
'height' => $he,
|
||||||
|
'html' => $ht,
|
||||||
|
'aperture' => $ap,
|
||||||
|
|
||||||
|
'model' => $mod,
|
||||||
|
|
||||||
|
'lat' => $gps['latitude'],
|
||||||
|
'long' => $gps['longitude'],
|
||||||
|
'alt' => $gps['altitude']
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
//_pr($photos);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($iptc = getimagesize($file, $info)) {
|
||||||
|
if (isset($info["APP13"])) {
|
||||||
|
$mots = "";
|
||||||
|
$iptc = iptcparse ($info["APP13"]);
|
||||||
|
$legende = (isset($iptc["2#120"][0])) ? $iptc["2#120"][0] : '';
|
||||||
|
$copyright = (isset($iptc["2#116"][0])) ? $iptc["2#116"][0] : '';
|
||||||
|
$titre = (isset($iptc["2#105"][0])) ? $iptc["2#105"][0] : '';
|
||||||
|
$createur = (isset($iptc["2#080"][0])) ? $iptc["2#080"][0] : '';
|
||||||
|
$mots_cles = (isset($iptc["2#025"])) ? $iptc["2#025"] : '';
|
||||||
|
foreach ($mots_cles as $m) {
|
||||||
|
$mots .= $m . ",";
|
||||||
|
}
|
||||||
|
$mots = substr($mots, 0, -1);
|
||||||
|
|
||||||
|
$photos[$i]['legende'] = $legende;
|
||||||
|
$photos[$i]['copyright'] = $copyright;
|
||||||
|
$photos[$i]['titre'] = $titre;
|
||||||
|
$photos[$i]['createur'] = $createur;
|
||||||
|
$photos[$i]['mots_cles'] = $mots;
|
||||||
|
|
||||||
|
//_pr($photos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//_pr($photos);
|
||||||
|
|
||||||
|
// Insertion des photos dans la base
|
||||||
|
// Création des vignettes
|
||||||
|
try {
|
||||||
|
$conn2 = new PDO('sqlite:db_photo.sqlite3');
|
||||||
|
$query2 = "INSERT OR IGNORE INTO photos (filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords) VALUES (:filename, :date, :lens, :exposure, :iso, :width, :height, :html, :aperture, :model, :lat, :long, :alt, :legende, :copyright, :titre, :createur, :keywords)";
|
||||||
|
|
||||||
|
$stmt = $conn2->prepare($query2);
|
||||||
|
$stmt->bindParam(':filename', $file);
|
||||||
|
$stmt->bindParam(':date', $da);
|
||||||
|
$stmt->bindParam(':lens', $obj);
|
||||||
|
$stmt->bindParam(':exposure', $ex);
|
||||||
|
$stmt->bindParam(':iso', $iso);
|
||||||
|
$stmt->bindParam(':width', $wi);
|
||||||
|
$stmt->bindParam(':height', $he);
|
||||||
|
$stmt->bindParam(':html', $ht);
|
||||||
|
$stmt->bindParam(':aperture', $ap);
|
||||||
|
$stmt->bindParam(':model', $mod);
|
||||||
|
$stmt->bindParam(':lat', $gps['latitude']);
|
||||||
|
$stmt->bindParam(':long', $gps['longitude']);
|
||||||
|
$stmt->bindParam(':alt', $gps['altitude']);
|
||||||
|
|
||||||
|
$stmt->bindParam(':legende', $leg);
|
||||||
|
$stmt->bindParam(':copyright', $cop);
|
||||||
|
$stmt->bindParam(':titre', $tit);
|
||||||
|
$stmt->bindParam(':createur', $crea);
|
||||||
|
$stmt->bindParam(':keywords', $mot);
|
||||||
|
|
||||||
|
if (isset($photos)) {
|
||||||
|
foreach ($photos as $item) {
|
||||||
|
$file = $item['filename'];
|
||||||
|
$da = $item['date'];
|
||||||
|
$obj = $item['lens'];
|
||||||
|
$ex = $item['exposure'];
|
||||||
|
$iso = $item['iso'];
|
||||||
|
$wi = $item['width'];
|
||||||
|
$he = $item['height'];
|
||||||
|
$ht = $item['html'];
|
||||||
|
$ap = $item['aperture'];
|
||||||
|
$mod = $item['model'];
|
||||||
|
$gps['latitude'] = $item['lat'];
|
||||||
|
$gps['longitude'] = $item['long'];
|
||||||
|
$gps['altitude'] = $item['alt'];
|
||||||
|
|
||||||
|
$leg = $item['legende'];
|
||||||
|
$cop = $item['copyright'];
|
||||||
|
$tit = $item['titre'];
|
||||||
|
$crea = $item['createur'];
|
||||||
|
$mot = $item['mots_cles'];
|
||||||
|
|
||||||
|
create_thumb($th_w, $th_h, $file);
|
||||||
|
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$conn2 = null;
|
||||||
|
}
|
||||||
|
catch(PDOException $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Affichage depuis la bdd */
|
||||||
|
/**/
|
||||||
|
try {
|
||||||
|
$conn4 = new PDO('sqlite:db_photo.sqlite3');
|
||||||
|
$query4 = "SELECT filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords FROM photos WHERE id >= ? AND id <= ? ORDER BY date DESC";
|
||||||
|
|
||||||
|
$stmt = $conn4->prepare($query4);
|
||||||
|
# id 1 -> 3
|
||||||
|
$stmt->execute(array(1, 3));
|
||||||
|
|
||||||
|
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
_pr($result);
|
||||||
|
|
||||||
|
$conn4 = null;
|
||||||
|
}
|
||||||
|
catch(PDOException $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
1154
js/photoswipe-lightbox.esm.js
Normal file
1154
js/photoswipe-lightbox.esm.js
Normal file
File diff suppressed because it is too large
Load Diff
1
js/photoswipe-lightbox.esm.js.map
Normal file
1
js/photoswipe-lightbox.esm.js.map
Normal file
File diff suppressed because one or more lines are too long
5192
js/photoswipe.esm.js
Normal file
5192
js/photoswipe.esm.js
Normal file
File diff suppressed because it is too large
Load Diff
1
js/photoswipe.esm.js.map
Normal file
1
js/photoswipe.esm.js.map
Normal file
File diff suppressed because one or more lines are too long
119
mois.php
119
mois.php
@@ -1,119 +0,0 @@
|
|||||||
<?php
|
|
||||||
$base = 'db_photo.sqlite3';
|
|
||||||
|
|
||||||
//Get a list of file paths using the glob function.
|
|
||||||
$fileList = glob('photos/img/*');
|
|
||||||
|
|
||||||
// Connexion
|
|
||||||
$conn = new PDO("sqlite:db_photo.sqlite3");
|
|
||||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
$query = "CREATE TABLE IF NOT EXISTS photos (
|
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
||||||
filename TEXT,
|
|
||||||
date TEXT,
|
|
||||||
lens TEXT,
|
|
||||||
width INTEGER,
|
|
||||||
height INTEGER,
|
|
||||||
UNIQUE(filename)
|
|
||||||
)";
|
|
||||||
$conn->exec($query);
|
|
||||||
/*
|
|
||||||
lens TEXT,
|
|
||||||
width INTEGER,
|
|
||||||
height INTEGER,
|
|
||||||
*/
|
|
||||||
|
|
||||||
function _pr($d) {
|
|
||||||
echo "<div style='border: 1px solid#ccc; padding: 10px;'>";
|
|
||||||
echo '<strong>' . debug_backtrace()[0]['file'] . ' ' . debug_backtrace()[0]['line'] . '</strong>';
|
|
||||||
echo "</div>";
|
|
||||||
echo '<pre>';
|
|
||||||
if(is_array($d)) {
|
|
||||||
print_r($d);
|
|
||||||
} else if(is_object($d)) {
|
|
||||||
var_dump($d);
|
|
||||||
}
|
|
||||||
echo '</pre>';
|
|
||||||
}
|
|
||||||
|
|
||||||
#_pr($items);
|
|
||||||
|
|
||||||
// Ajout de données dans la table
|
|
||||||
foreach($fileList as $file){
|
|
||||||
$exif = exif_read_data($file,'EXIF' ,0 );
|
|
||||||
#_pr($exif);
|
|
||||||
$ht = $exif['COMPUTED']['html'];
|
|
||||||
$wi = $exif['COMPUTED']['Width'];
|
|
||||||
$he = $exif['COMPUTED']['Height'];
|
|
||||||
$ap = $exif['COMPUTED']['ApertureFNumber'];
|
|
||||||
# YYYY-MM-DD HH:MM:SS.SSS - 2019:10:01 14:03:12
|
|
||||||
$da = $exif['DateTimeOriginal'];
|
|
||||||
$mod = $exif['Model'];
|
|
||||||
$ex = $exif['ExposureTime'];
|
|
||||||
$iso = $exif['ISOSpeedRatings'];
|
|
||||||
$obj = isset($exif['UndefinedTag:0xA434']) ? $exif['UndefinedTag:0xA434'] : "";
|
|
||||||
|
|
||||||
#echo $file . " - " . $ww . " - " . $hh . " - " . $dd . "<br>";
|
|
||||||
|
|
||||||
$photos[] = array(
|
|
||||||
'filename' => $file,
|
|
||||||
'date' => $da,
|
|
||||||
'lens' => $obj,
|
|
||||||
'width' => $wi,
|
|
||||||
'height' => $he
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#_pr($photos);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$conn2 = new PDO('sqlite:db_photo.sqlite3');
|
|
||||||
$query2 = "INSERT OR IGNORE INTO photos (filename, date, lens, width, height) VALUES (:filename, :date, :lens, :width, :height)";
|
|
||||||
|
|
||||||
$stmt = $conn2->prepare($query2);
|
|
||||||
$stmt->bindParam(':filename', $file);
|
|
||||||
$stmt->bindParam(':date', $da);
|
|
||||||
$stmt->bindParam(':lens', $obj);
|
|
||||||
$stmt->bindParam(':width', $wi);
|
|
||||||
$stmt->bindParam(':height', $he);
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($photos as $item) {
|
|
||||||
_pr($item);
|
|
||||||
$file = $item['filename'];
|
|
||||||
$da = $item['date'];
|
|
||||||
$obj = $item['lens'];
|
|
||||||
$wi = $item['width'];
|
|
||||||
$he = $item['height'];
|
|
||||||
|
|
||||||
$stmt->execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
#header('location: index.php');
|
|
||||||
|
|
||||||
$conn2 = null;
|
|
||||||
}
|
|
||||||
catch(PDOException $e) {
|
|
||||||
echo $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
/**/
|
|
||||||
try {
|
|
||||||
$conn3 = new PDO('sqlite:db_photo.sqlite3');
|
|
||||||
$query3 = "SELECT filename, date, lens, width, height FROM photos WHERE id >= ? AND id <= ? ORDER BY date DESC";
|
|
||||||
|
|
||||||
$stmt = $conn3->prepare($query3);
|
|
||||||
# id 1 -> 3
|
|
||||||
$stmt->execute(array(1, 3));
|
|
||||||
|
|
||||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
_pr($result);
|
|
||||||
|
|
||||||
$conn3 = null;
|
|
||||||
}
|
|
||||||
catch(PDOException $e) {
|
|
||||||
echo $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
266
photo-du-mois.php
Normal file
266
photo-du-mois.php
Normal file
@@ -0,0 +1,266 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>Document</title>
|
||||||
|
<link rel="stylesheet" href="css/photoswipe.css">
|
||||||
|
<!--script src="js/photoswipe.esm.js"></script>
|
||||||
|
<script src="js/photoswipe-lightbox.esm.js"></script-->
|
||||||
|
<link rel="stylesheet" href="css/sls.css">
|
||||||
|
|
||||||
|
|
||||||
|
<?php include 'functions.php'; ?>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
// Include Lightbox
|
||||||
|
import PhotoSwipeLightbox from './js/photoswipe-lightbox.esm.js';
|
||||||
|
|
||||||
|
const backEasing = {
|
||||||
|
in: 'cubic-bezier(0.6, -0.28, 0.7, 1)',
|
||||||
|
out: 'cubic-bezier(0.3, 0, 0.32, 1.275)',
|
||||||
|
inOut: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)'
|
||||||
|
};
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
// may select multiple "galleries"
|
||||||
|
gallery: '#gallery--simple',
|
||||||
|
|
||||||
|
// Elements within gallery (slides)
|
||||||
|
children: 'a',
|
||||||
|
//showHideAnimationType: 'zoom',
|
||||||
|
//showAnimationDuration: 1000,
|
||||||
|
//hideAnimationDuration: 1000,
|
||||||
|
|
||||||
|
// Include PhotoSwipe Core
|
||||||
|
// and use absolute path (that starts with http(s)://)
|
||||||
|
//pswpModule: 'https://airbook.local/sls/js/photoswipe.esm.js'
|
||||||
|
pswpModule: 'https://<?php echo $_SERVER["SERVER_NAME"]; ?>/sls/js/photoswipe.esm.js'
|
||||||
|
};
|
||||||
|
|
||||||
|
const lightbox = new PhotoSwipeLightbox(options);
|
||||||
|
lightbox.on('uiRegister', function() {
|
||||||
|
lightbox.pswp.ui.registerElement({
|
||||||
|
name: 'custom-caption',
|
||||||
|
order: 9,
|
||||||
|
isButton: false,
|
||||||
|
appendTo: 'root',
|
||||||
|
html: 'Caption text',
|
||||||
|
onInit: (el, pswp) => {
|
||||||
|
lightbox.pswp.on('change', () => {
|
||||||
|
const currSlideElement = lightbox.pswp.currSlide.data.element;
|
||||||
|
let captionHTML = '';
|
||||||
|
if (currSlideElement) {
|
||||||
|
const hiddenCaption = currSlideElement.querySelector('.hidden-caption-content');
|
||||||
|
if (hiddenCaption) {
|
||||||
|
// get caption from element with class hidden-caption-content
|
||||||
|
captionHTML = hiddenCaption.innerHTML;
|
||||||
|
} else {
|
||||||
|
// get caption from alt attribute
|
||||||
|
captionHTML = currSlideElement.querySelector('img').getAttribute('alt');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
el.innerHTML = captionHTML || '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
lightbox.init();
|
||||||
|
|
||||||
|
lightbox.on('firstUpdate', () => {
|
||||||
|
lightbox.pswp.options.easing = backEasing.out;
|
||||||
|
});
|
||||||
|
lightbox.on('initialZoomInEnd', () => {
|
||||||
|
lightbox.pswp.options.easing = backEasing.inOut;
|
||||||
|
});
|
||||||
|
lightbox.on('close', () => {
|
||||||
|
lightbox.pswp.options.easing = backEasing.in;
|
||||||
|
});
|
||||||
|
|
||||||
|
lightbox.init();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Photo du mois</h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
//nb d'archive par page
|
||||||
|
//$nb = 13;
|
||||||
|
|
||||||
|
if (!isset($_GET['page'])) $page = 1;
|
||||||
|
// sinon on recupere la valeur numerique reçue en paramètre
|
||||||
|
else $page = intval($_GET['page']);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// on determine debut du limit
|
||||||
|
$debut = (($page - 1) * $nb) +1; // page 1: 2, page 2: 14, page 3: 26
|
||||||
|
$fin = ($debut + $nb) - 1;
|
||||||
|
|
||||||
|
echo "debut: " . $debut . "<br>";
|
||||||
|
echo "fin: " . $fin . "<br>";
|
||||||
|
echo "page: " . $page . "<br>";
|
||||||
|
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
try {
|
||||||
|
$conn4 = new PDO('sqlite:db_photo.sqlite3');
|
||||||
|
$query4 = "SELECT filename, date, lens, exposure, iso, width, height, html, aperture, model, lat, long, alt, legende, copyright, titre, createur, keywords FROM photos ORDER BY date DESC LIMIT ? OFFSET ?";
|
||||||
|
//nb d'archive par page
|
||||||
|
$limit = 13;
|
||||||
|
$offset = $limit * ($page -1);
|
||||||
|
//echo "offset: " . $offset;
|
||||||
|
|
||||||
|
$stmt = $conn4->prepare($query4);
|
||||||
|
$stmt->execute(array($limit, $offset));
|
||||||
|
|
||||||
|
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
//_pr($result);
|
||||||
|
$rowcount = count($result);
|
||||||
|
|
||||||
|
$conn4 = null;
|
||||||
|
}
|
||||||
|
catch(PDOException $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
$photo_du_mois = $result[0];
|
||||||
|
$z = $photo_du_mois['date'];
|
||||||
|
|
||||||
|
$photo_du_mois['titre'] = "Titre";
|
||||||
|
$photo_du_mois['legende'] = "Légende";
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<p><?php echo month($z); ?></p>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
//_pr($photo_du_mois);
|
||||||
|
echo '<div class="cadre">';
|
||||||
|
echo '<img src="' . $photo_du_mois['filename'] . '" class="trois" />';
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
if (!empty($photo_du_mois['titre']) || !empty($photo_du_mois['legende'])) {
|
||||||
|
?>
|
||||||
|
<p class="titrePhoto"><?php echo $photo_du_mois['titre']; ?></p>
|
||||||
|
<p class="legendePhoto"><?php echo $photo_du_mois['legende']; ?></p>
|
||||||
|
<?php }
|
||||||
|
|
||||||
|
echo '<div class="exif">';
|
||||||
|
echo $photo_du_mois['model'] . " \u{30FB} " . $photo_du_mois['lens'] . " \u{30FB} ";
|
||||||
|
echo $photo_du_mois['exposure'] . " \u{30FB} " . $photo_du_mois['aperture'] . " \u{30FB} " . $photo_du_mois['iso'] . " ISO";
|
||||||
|
echo '</div>';
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="myGallery" id="gallery--simple">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**/
|
||||||
|
for ($i = 1; $i <= ($rowcount -1); $i++) {
|
||||||
|
$file = $result[$i]['filename'];
|
||||||
|
$date = $result[$i]['date'];
|
||||||
|
$objectif = $result[$i]['lens'];
|
||||||
|
$exposure = $result[$i]['exposure'];
|
||||||
|
$iso = $result[$i]['iso'];
|
||||||
|
$width = $result[$i]['width'];
|
||||||
|
$height = $result[$i]['height'];
|
||||||
|
$html = $result[$i]['html'];
|
||||||
|
$aperture = $result[$i]['aperture'];
|
||||||
|
$model = $result[$i]['model'];
|
||||||
|
|
||||||
|
$lat = $result[$i]['lat'];
|
||||||
|
$long = $result[$i]['long'];
|
||||||
|
$alt = $result[$i]['alt'];
|
||||||
|
|
||||||
|
$legende = $result[$i]['legende'];
|
||||||
|
$copy = $result[$i]['copyright'];
|
||||||
|
$titre = $result[$i]['titre'];
|
||||||
|
$createur = $result[$i]['createur'];
|
||||||
|
$keywords = $result[$i]['keywords'];
|
||||||
|
//$keywords = str_replace(',', ' - ', $keywords);
|
||||||
|
$keywords = "\u{1F3F7} " . str_replace(',', " \u{30FB} ", $keywords);
|
||||||
|
|
||||||
|
$thumb = str_replace("photos/img", "photos/thumb", $file);
|
||||||
|
echo '<div class="item">';
|
||||||
|
echo '<a href ="' . $file . '" data-pswp-width="' . $width . '"' . '" data-pswp-height="'. $height . '" target="_blank">';
|
||||||
|
echo '<img src="' . $thumb . '" alt="' . basename($file) . '" />';
|
||||||
|
echo "</a>";
|
||||||
|
echo '<span class="caption">' . month($date) . '</span>';
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
$rowcount = 5 - 10 - 15 => add 0
|
||||||
|
$rowcount = 4 - 9 - 14 => add 1
|
||||||
|
$rowcount = 3 - 8 - 13 => add 2
|
||||||
|
$rowcount = 2 - 7 - 12 => add 3
|
||||||
|
$rowcount = 1 - 6 - 11 => add 4
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($rowcount % 4 == 0) $blank = 1;
|
||||||
|
elseif ($rowcount % 3 == 0) $blank = 2;
|
||||||
|
elseif ($rowcount % 2 == 0) $blank = 3;
|
||||||
|
elseif ($rowcount % 1 == 0) $blank = 4;
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $blank; $i++) {
|
||||||
|
echo '<div class="item">';
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
try {
|
||||||
|
$conn4 = new PDO('sqlite:db_photo.sqlite3');
|
||||||
|
$query4 = "SELECT COUNT(*) AS count FROM photos";
|
||||||
|
|
||||||
|
$stmt = $conn4->prepare($query4);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$numRows = $result['count'];
|
||||||
|
|
||||||
|
$conn4 = null;
|
||||||
|
}
|
||||||
|
catch(PDOException $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// calcul du nombre de pages (arrondi a l'entier supérieur)
|
||||||
|
$nbpages = ceil($numRows / 12);
|
||||||
|
$prec = $page - 1;
|
||||||
|
$suiv = $page + 1;
|
||||||
|
|
||||||
|
echo '<div class="navPage">' . gettext("Page: ");
|
||||||
|
if ($page >= 2) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$prec.'" title="'.gettext("Previous Page").'">« '.gettext("prev").'</a> ';
|
||||||
|
for ($i = 1; $i <= $nbpages; $i++) {
|
||||||
|
if ($i != $page) {
|
||||||
|
echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$i.'" title="'.gettext("Page").' '.$i.'">'.$i.' </a> ';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "<span class='gras'>".$i."</span> ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($page < $nbpages) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$suiv.'" title="'.gettext("Next Page").'">'.gettext("next").' »</a> ';
|
||||||
|
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<p><em><small>@ 2023</small></em></p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user