Files
creator-child/fonctions.php
Bruno Pesenti 6df0f90b09 Single v1
-commentaires cachés
-settings
-3 lightbox
-enqueue js et css
2017-01-16 06:32:13 +01:00

154 lines
4.0 KiB
PHP

<?php
function preprint($s, $return=false) {
$x = "<pre>";
$x .= print_r($s, 1);
$x .= "</pre>";
if ($return) return $x;
else print $x;
}
function displayRetina ($filename,$album) {
$path = "../../../../zenphoto/cache/" . $album . "/";
$file = explode(".", $filename);
//echo $path . $filename . "<br>";
$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;
$thumb = array();
$standard = "";
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 .= '<!--[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.'&amp;image='.$filename.'" title= "'.date_archive($filename).'" class="" />';
$display .= '<span class="exif">'.date_archive($filename).'</span>';
$display .= '</a></div>';
$display .= '</div>';
*/
/**/
$display = '<div class="album">';
$display .= '<a href="../../zenphoto/albums/'.$album.'/'.$filename.'" title="'.date_archive($filename).'" class="swipebox" />';
$display .= '<div class="holder">';
//$display .= '<picture data-picture data-alt="">';
//$display .= '<source class="image_standard" srcset="' . $standard . '">';
$display .= '<img srcset="' . $thumb['sd']['url'] . '" width="' . $thumb['sd']['width'] . '" height="' . $thumb['sd']['height'] . '"alt="">';
//$display .= '</picture>';
$display .= '</div>';
$display .= '</a>';
$display .= '<div class="albumdesc">';
$display .= '<span class="exif">';
$display .= '<a href="../../zenphoto/index.php?album='.$album.'&amp;image='.$filename.'" title= "'.date_archive($filename).'" class="" />'.date_archive($filename).'</a>';
$display .= '</span></div>';
$display .= '</div>';
return $display;
}
function date_archive ($chaine) {
$pieces = explode(".", $chaine);
$b = explode("_", $pieces[0]);
$mois = $b[0];
$an = $b[1];
$chaine = mois2($mois) . ' '. $an;
return $chaine;
}
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;
}
?>