# HG changeset patch # User Matti Hamalainen # Date 1442222949 -10800 # Node ID 3f7bc4202df3d5c28a08f4c7e23c32c144bd4e97 # Parent 3491ab93630eaa55d0a52d593c77c4ca3d9c5afe Add new configuration setting 'cover_images' to disable/enable sub-album cover images. diff -r 3491ab93630e -r 3f7bc4202df3 example.cfg --- 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 diff -r 3491ab93630e -r 3f7bc4202df3 mgallery.inc.php --- 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, ""), diff -r 3491ab93630e -r 3f7bc4202df3 mgallery.php --- 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 - " ". - "\"".chentities($data["caption"])."\"\n". + " ". + "\"".chentities($data["caption"])."\"\n". "
".chentities($data["caption"])."
\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");