Mercurial > hg > mgallery
comparison mgtool.php @ 317:d66caa602023
Add better checks for custom/user selected album cover image.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 06 Apr 2020 20:26:11 +0300 |
parents | af5ce7bf7eeb |
children | bf4115b6dc2a |
comparison
equal
deleted
inserted
replaced
316:af5ce7bf7eeb | 317:d66caa602023 |
---|---|
845 } | 845 } |
846 | 846 |
847 uasort($images, "mgSortFunc"); | 847 uasort($images, "mgSortFunc"); |
848 krsort($albums); | 848 krsort($albums); |
849 | 849 |
850 // Choose gallery album image | 850 // Choose gallery album cover image |
851 if (count($images) > 0) | 851 if (count($images) > 0) |
852 { | 852 { |
853 if (isset($gallery["albumpic"]) && | 853 // Is the cover image set in the album data? |
854 isset($images[$gallery["albumpic"]])) | 854 if (isset($gallery["albumpic"])) |
855 { | 855 { |
856 $parentEntry["image"] = $gallery["albumpic"]; | 856 if (!isset($images[$gallery["albumpic"]])) |
857 } | 857 mgError("Album cover picture '".$gallery["albumpic"]."' set, but is not found in \n"); |
858 else | 858 else |
859 { | 859 $parentEntry["image"] = $gallery["albumpic"]; |
860 } | |
861 | |
862 // Got anything? | |
863 if (!isset($parentEntry["image"])) | |
864 { | |
865 // No, use the last image in the album | |
860 end($images); | 866 end($images); |
861 $parentEntry["image"] = key($images); | 867 $parentEntry["image"] = key($images); |
862 } | 868 } |
863 } | 869 } |
864 else | 870 else |