From dcce90e8c033022c87a318c5f347aedc54b11fda Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 21 Aug 2021 13:33:49 +0100 Subject: [PATCH] Use default image if not found --- webapp_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/webapp_utils.py b/webapp_utils.py index 584376529..0db08fc61 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -468,6 +468,16 @@ def _getImageFile(baseDir: str, name: str, directory: str, bannerExtensions = getImageExtensions() bannerFile = '' bannerFilename = '' + for ext in bannerExtensions: + bannerFileTest = name + '.' + ext + bannerFilenameTest = directory + '/' + bannerFileTest + if os.path.isfile(bannerFilenameTest): + bannerFile = name + '_' + theme + '.' + ext + bannerFilename = bannerFilenameTest + return bannerFile, bannerFilename + # if not found then use the default image + theme = 'default' + directory = baseDir + '/' + theme + '/default' for ext in bannerExtensions: bannerFileTest = name + '.' + ext bannerFilenameTest = directory + '/' + bannerFileTest