add $display_filename option to show the filename under the picture

This commit is contained in:
cyberic99 2014-09-14 11:57:21 +02:00
parent dfadcf8a85
commit c7a987d436
2 changed files with 11 additions and 3 deletions

View file

@ -47,4 +47,5 @@ $SkipObjects = array('UnDossier', 'UnFichier'); //Those files and folders will
$thumb_size = 320; //Thumbnail height/width (square thumbs). Changing this will most likely require manual altering of the template file to make it look properly!
$label_max_length = 40; //Maximum chars of a folder name that will be displayed on the folder thumbnail
$display_exif = 0; //Take care, even if not diplayed EXIF are still readable for visitors. May be a good idea to erase EXIF data...
$display_filename = 0; //Show file names below the pictures
?>

View file

@ -227,6 +227,12 @@ if (file_exists($currentdir ."/captions.txt"))
// 3. LOAD FILES
if ($file != "." && $file != ".." && $file != "folder.jpg")
{
if($display_filename) {
$filename_caption="<em>" . padstring($file, $label_max_length) . "</em>";
}
else {
$filename_caption="";
}
// JPG, GIF and PNG
if (preg_match("/.jpg$|.gif$|.png$/i", $file))
{
@ -256,12 +262,13 @@ if (file_exists($currentdir ."/captions.txt"))
"name" => $file,
"date" => filemtime($currentdir . "/" . $file),
"size" => filesize($currentdir . "/" . $file),
"html" => "<li><a href='" . $currentdir . "/" . $file . "' rel='lightbox[billeder]' title=\"".htmlentities($img_captions[$file])."\"><img class=\"b-lazy\" src=data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== data-src='" . GALLERY_ROOT . "createthumb.php?filename=" . $thumbdir . "/" . $file . "&amp;size=$thumb_size' alt='$label_loading' /></a></li>"); } else {
"html" => "<li><a href='" . $currentdir . "/" . $file . "' rel='lightbox[billeder]' title=\"".htmlentities($img_captions[$file])."\"><img class=\"b-lazy\" src=data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== data-src='" . GALLERY_ROOT . "createthumb.php?filename=" . $thumbdir . "/" . $file . "&amp;size=$thumb_size' alt='$label_loading' /></a>" . $filename_caption . "</li>");
} else {
$files[] = array (
"name" => $file,
"date" => filemtime($currentdir . "/" . $file),
"size" => filesize($currentdir . "/" . $file),
"html" => "<li><a href='" . $currentdir . "/" . $file . "' rel='lightbox[billeder]' title=\"".htmlentities($img_captions[$file])."\"><img src='" . GALLERY_ROOT . "createthumb.php?filename=" . $thumbdir . "/" . $file . "&amp;size=$thumb_size' alt='$label_loading' /></a></li>"); }
"html" => "<li><a href='" . $currentdir . "/" . $file . "' rel='lightbox[billeder]' title=\"".htmlentities($img_captions[$file])."\"><img src='" . GALLERY_ROOT . "createthumb.php?filename=" . $thumbdir . "/" . $file . "&amp;size=$thumb_size' alt='$label_loading' /></a>" . $filename_caption . "</li>"); }
}
// Other filetypes
$extension = "";
@ -281,7 +288,7 @@ if (file_exists($currentdir ."/captions.txt"))
"name" => $file,
"date" => filemtime($currentdir . "/" . $file),
"size" => filesize($currentdir . "/" . $file),
"html" => "<li><a href='" . $currentdir . "/" . $file . "' title='$file'><em-pdf>" . padstring($file, 20) . "</em-pdf><span></span><img src='" . GALLERY_ROOT . "images/filetype_" . $extension . ".png' width='$thumb_size' height='$thumb_size' alt='$file' /></a></li>");
"html" => "<li><a href='" . $currentdir . "/" . $file . "' title='$file'><em-pdf>" . padstring($file, 20) . "</em-pdf><span></span><img src='" . GALLERY_ROOT . "images/filetype_" . $extension . ".png' width='$thumb_size' height='$thumb_size' alt='$file' /></a>" . $filename_caption . "</li>");
}
}
}