Files
toppic-child/page-ce-mois-ci.php
Bruno 21 367202a7b5 Bugfix
-pagination
-liens texte sous les. vignettes
2019-01-05 21:02:25 +01:00

374 lines
11 KiB
PHP
Executable File

<?php
/**
* Template Name: Ce-mois-ci
*
*/
get_header() ?>
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
define('SERVERPATH',$root.'/zenphoto');
include('../photoblog/exifer/exif.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/Connections/cnx.php');
//nb d'archive par page
$nb = 12;
global $ppage;
$url = $_SERVER['REDIRECT_URL'];
$a = explode("/", $url);
$pages = end($a);
$pages = prev($a);
if ($pages != get_page_uri()) $ppage = $pages;
else $ppage = "1";
$kk_parallax = kk_parallax();
$title_type = $kk_parallax[0];
$bg_title_img = $kk_parallax[1];
?>
<?php if ( post_password_required( $post ) ) {
get_template_part( 'password-form' );
} else {
?>
<!-- start main container -->
<div class="content page-content">
<?php if( $title_type == 'parallax' ) { ?>
<div id="kk-parallax-wrapper" class="kk-parallax-wrapper">
<div id="kk-parallax-bg" class="kk-parallax-bg kk-hidden">
<img id="kk-img-check" src="<?php echo esc_url( $bg_title_img ) ?>" alt="<?php echo esc_attr( $kk_parallax[2] ) ?>" />
</div>
<div id="kk-parallax-title-wrapper" class="kk-parallax-title-wrapper">
<div id="kk-parallax-title" class="page-title">
<?php the_title( '<h1>', '</h1>' ); ?>
</div>
</div>
<a id="kk-down" class="kk-down is-loading" href="#kk-to-me"></a>
</div>
<?php } ?>
<div class="content-inner-wrapper clearfix">
<span id="kk-to-me"></span>
<?php if( $title_type == 'default' ) { ?>
<div class="post-title">
<?php the_title( '<h1>', '</h1>' ); ?>
</div>
<div class="divider clear"></div>
<?php } ?>
<div class="inner-content">
<?php the_post(); ?>
<?php the_content (); ?>
<?php
/*** Photos du mois ***/
$album = 'photos-du-mois'; //Photos du mois
$images_du_mois = imagesFromZPAlbum($album, $connexion);
/*
1_2018_40_cw40_ch40_thumb.jpg
1_2018_80_cw80_ch80_thumb.jpg
1_2018_200_thumb.jpg thumb WP SD
1_2018_300_thumb.jpg
1_2018_400_thumb.jpg thumb WP HD
1_2018_800_clicclac.jpg image du mois SD
1_2018_w1400_h550_thumb.jpg
*/
$watermark = "_clicclac";
$i = 0;
while ($i < 13) {
//$file = '../zenphoto/albums/photos-du-mois/' . $tableau[$i];
$file = '../zenphoto/albums/photos-du-mois/' . $images_du_mois[$i]['filename'];
//$file = 'https://silverbook.local/zenphoto/albums/photos-du-mois/' . $images_du_mois[$i]['filename'];
if (file_exists($file)) {
//$photo_du_mois = $file;
//$title = $tableau[$i];
$filename = $images_du_mois[$i]['filename'];
$size = getimagesize($file, $info);
//preprint($size);
if ($size[0] > 1000) {
// HD
//$hd = '../../zenphoto/cache/photos-du-mois/' . substr($tableau[$i], 0, strlen($tableau[$i]) - 4) . "_FULL_watermark.jpg";
$hd = $file;
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
// 12_2017_800_clicclac.jpg
$sd = '../zenphoto/cache/photos-du-mois/' . substr($filename, 0, strlen($filename) - 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($filename, 0, strlen($filename) - 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)
foreach ($images_du_mois[$i] as $key => $val) {
$imgs[$key] = $val;
}
// Ajouter les tags
// Présentation Title et Desc
//preprint($imgs);
/*
Array
(
[img_hd] => Array
(
[url] => ../../zenphoto/albums/photos-du-mois/11_2018.jpg
[width] => 1600
[height] => 1067
)
[img_sd] => Array
(
[url] => ../../zenphoto/cache/photos-du-mois/11_2018_800_clicclac.jpg
[width] => 800
[height] => 534
)
[filename] => 11_2018.jpg
[EXIFModel] => Canon EOS-1D Mark IV
[EXIFDateTimeOriginal] => 2018:11:04 11:05:09
[EXIFExposureTime] => 1/2000 sec
[EXIFFNumber] => f/7,1
[EXIFISOSpeedRatings] => 500
[EXIFFocalLength] => 700 mm
[EXIFLensInfo] => EF500mm f/4L IS USM +1.4x
[EXIFGPSLatitude] =>
[EXIFGPSLatitudeRef] =>
[EXIFGPSLongitude] =>
[EXIFGPSLongitudeRef] =>
[EXIFGPSAltitude] =>
[EXIFGPSAltitudeRef] =>
[desc] =>
[title] => 11_2018
[exif] => Le 04.11.2018 à 11:05 - 1/2000 sec à f/7,1 - 500 ISO - Focale700 mm
[exif+] => Canon EOS-1D Mark IV - EF500mm f/4L IS USM +1.4x
[gps] =>
)
*/
/*
$keyword = "";
if (isset($iptc['2#025'])) {
foreach ($iptc['2#025'] as $key => $val) {
$keyword .= '<a href="' . $host . '/zenphoto/index.php?p=search&amp;words=' . $val . '" title="Tag > ' . $val . '" rel="tag">' . $val . '</a>';
$keyword .= ', ';
}
$keyword = substr($keyword, 0, -2);
}
$imgs['img_sd']['keyword'] = $keyword;
}
*/
$exifInfo = "";
$exifInfo = __('The','toppic-child') . " " .date(__("F j, Y, g:i a",'toppic-child'),strtotime($imgs['EXIFDateTimeOriginal'])).' - ';
$exifInfo .= $imgs['EXIFExposureTime'] . __(' at ','toppic-child') . $imgs['EXIFFNumber'] .' - ' . $imgs['EXIFISOSpeedRatings'] .' ISO - ' . __('Focal','toppic-child') .$imgs['EXIFFocalLength'];
$imgs['exif'] = $exifInfo;
$imgs['exif+'] = $imgs['EXIFModel'] . ' - ' . $imgs['EXIFLensInfo'];
$imgs['gps'] = '';
break;
}
$i++;
}
?>
<?php if ($ppage == "1") { ?>
<!-- image du mois -->
<div class="cadre">
<?php if (($imgs['title'] != "") || ($imgs['desc'] != "")) { ?>
<p class="titrePhoto"><?php echo $imgs['title']; ?></p>
<p class="legendePhoto"><?php echo $imgs['desc']; ?></p>
<?php }
if (($imgs['img_sd']['url'] != "") && ($imgs['img_hd']['url'] != "")) {
$standard_source = $imgs['img_sd']['url'] . ' 800w, ' . $imgs['img_hd']['url'] . ' 1600w';
}
else if ($imgs['img_sd']['url'] != "") {
$standard_source = $imgs['img_sd']['url'] . ' 800w';
}
else if ($imgs['img_hd']['url'] != "") {
$standard_source = $imgs['img_hd']['url'] . ' 1600w';
}
$display = '<a href="' . $imgs['img_hd']['url'] .'" title="'.$imgs['title'].'" class="kk-lightbox">';
$display .= "<img width='" . $imgs['img_sd']['width'] . "' height='" . $impgs['img_sd']['height'] . "' src='" . $imgs['img_sd']['url'] . "' class='' alt='' srcset='" . $standard . "' sizes='(max-width: 800px) 100vw, 800px' />";
$display .= '</a>';
echo $display;
?>
</div><!-- /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 } ?>
<p class="exifs"><?php echo $imgs['exif']; ?></p>
<!-- /image du mois -->
<?php } ?>
<?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" class="modele">
<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
$album = 'photos-du-mois'; //Photos du mois
//$fichier = imagesFromZPAlbum($album, $connexion);
//preprint($images_du_mois);
$debut = (($ppage - 1) * $nb) +1; // page 1: 2, page 2: 14, page 3: 26
$fin = ($debut + $nb) - 1;
/**/
for ($j=$debut; $j<=$fin; $j++) {
/*
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);
*/
if ($j <= count($images_du_mois)-1) echo displayRetina($images_du_mois[$j],$album);
if ($j+1 <= count($images_du_mois)-1) echo displayRetina($images_du_mois[$j+1],$album);
if ($j+2 <= count($images_du_mois)-1) echo displayRetina($images_du_mois[$j+2],$album);
$j = $j + 2;
}
?>
<p style="clear: both; "></p>
<div class="blog-pagination">
<?php
/**/
// calcul du nombre de pages (arrondi a l'entier superieur)
$nbpages = ceil(count($images_du_mois) / 12);
$prec = $ppage - 1;
$suiv = $ppage + 1;
if ($ppage >= 2) echo '<a class="prev page-numbers" href="'.$_SERVER['REQUEST_URI'].'?page='.$prec.'" title="'.gettext("Previous Page").'"> ← </a>&nbsp;';
for ($i = 1; $i <= $nbpages; $i++) {
if ($i != $ppage) {
echo '<a class="page-numbers" href="'.$_SERVER['REQUEST_URI'].'?page='.$i.'" title="'.gettext("Page").' '.$i.'">'.$i.' </a>&nbsp;';
}
else {
echo "<span class='current page-numbers'>".$i."</span>&nbsp;&nbsp;";
}
}
if ($page < $nbpages) echo '<a class="next page-numbers" href="'.$_SERVER['REQUEST_URI'].'?page='.$suiv.'" title="'.gettext("Next Page").'"> → </a>&nbsp;';
?>
</div>
</div>
<?php
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages', 'toppic' ) . '</span>',
'after' => '</div>',
'link_before' => '<span class="link-num">',
'link_after' => '</span>'
)
);
?>
</div>
</div>
<?php get_template_part('extends/footer-area') ?>
</div>
<!-- end container -->
<?php } ?>
<?php get_footer()?>