# HG changeset patch # User Matti Hamalainen # Date 1462180801 -10800 # Node ID 985596db0f01df25e84c32f2c7dd511905569e85 # Parent e786771dfaa52a46098da24603988c1e4e1e429f Implement recursive depth album covers. diff -r e786771dfaa5 -r 985596db0f01 mgallery.php --- a/mgallery.php Sat Apr 23 20:14:23 2016 +0300 +++ b/mgallery.php Mon May 02 12:20:01 2016 +0300 @@ -179,7 +179,25 @@ } else { - $atmp = ($galUseCoverImages && isset($data["image"])) ? $galImageURL.mgCleanPath(TRUE, $galPath, $filename, $galTNPath, $data["image"]) : $galAlbumIcon; + if ($galUseCoverImages && isset($data["image"])) + { + // Recursively determine the album cover image + $ptmp = [$galPath, $filename]; + $curr = &$data; + while (is_array($curr["image"])) + { + $curr = &$curr["image"]; + $ptmp[] = $curr["base"]; + } + + $ptmp[] = $galTNPath; + $ptmp[] = $curr["image"]; + $atmp = $galImageURL.implode("/", mgCleanPathArray(TRUE, 0, count($ptmp), $ptmp)); + } + else + // No album cover, use default + $atmp = $galAlbumIcon; + echo " ". "\"".chentities($data["caption"])."\"\n". diff -r e786771dfaa5 -r 985596db0f01 mgtool.php --- a/mgtool.php Sat Apr 23 20:14:23 2016 +0300 +++ b/mgtool.php Mon May 02 12:20:01 2016 +0300 @@ -362,6 +362,13 @@ end($images); $parentEntry["image"] = key($images); } + else + foreach ($albums as $aid => &$adata) + if (isset($adata["image"])) + { + $parentEntry["image"] = &$adata; + break; + } $str = "