Mercurial > hg > mgallery
changeset 17:3f7bc4202df3
Add new configuration setting 'cover_images' to disable/enable sub-album
cover images.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 14 Sep 2015 12:29:09 +0300 |
parents | 3491ab93630e |
children | 8c1599a30120 |
files | example.cfg mgallery.inc.php mgallery.php |
diffstat | 3 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/example.cfg Mon Sep 14 10:57:10 2015 +0300 +++ b/example.cfg Mon Sep 14 12:29:09 2015 +0300 @@ -19,6 +19,9 @@ navi_ctrl_prev = "<< prev" navi_ctrl_next = "next >>" +; Use image from sub-album as album cover image +cover_images = yes + ;;; ;;; Important paths and urls
--- a/mgallery.inc.php Mon Sep 14 10:57:10 2015 +0300 +++ b/mgallery.inc.php Mon Sep 14 12:29:09 2015 +0300 @@ -58,6 +58,7 @@ "info_file" => array(MG_STR, "gallery.info"), "cache_file" => array(MG_STR, ".mgallery.cache"), + "cover_images" => array(MG_BOOL, TRUE), "clean_urls" => array(MG_BOOL, FALSE), "title_prefix" => array(MG_STR, ""),
--- a/mgallery.php Mon Sep 14 10:57:10 2015 +0300 +++ b/mgallery.php Mon Sep 14 12:29:09 2015 +0300 @@ -125,7 +125,7 @@ function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit) { - global $galAlbumIcon, $galPath, $galTNPath; + global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages; $galCount = count($galIndex); if ($start >= $galCount) @@ -174,9 +174,10 @@ } else { + $atmp = ($galUseCoverImages && isset($data["image"])) ? $galImageURL.mgCleanPath(TRUE, $galPath, $filename, $galTNPath, $data["image"]) : $galAlbumIcon; echo - " <a href=\"".mgGetURL(mgCleanPath(TRUE, $galPath, $data["base"]), FALSE)."\">". - "<img class=\"albumIcon\" src=\"".$galAlbumIcon."\" alt=\"".chentities($data["caption"])."\" />\n". + " <a href=\"".mgGetURL(mgCleanPath(TRUE, $galPath, $filename), FALSE)."\">". + "<img class=\"albumIcon\" src=\"".$atmp."\" alt=\"".chentities($data["caption"])."\" />\n". "<div class=\"albumTitle\">".chentities($data["caption"])."</div></a>\n"; } @@ -249,6 +250,8 @@ $galBaseURL = mgGetSetting("base_url"); $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url")); +$galUseCoverImages = mgGetSetting("cover_images"); + $galAlbumIcon = mgGetSetting("album_icon"); $galCleanURLS = mgGetSetting("clean_urls"); $galTNPath = mgGetSetting("tn_path");