diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-03-11 12:33:24 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-03-11 12:33:24 +0000 |
commit | 9320139bd8340e8b12c178fe80411c8e25f78d9e (patch) | |
tree | 1f9a56832a5caf73dd4412c931acefab9545f28d /modules/ui_extra_networks.py | |
parent | ce68ab8d0dfdd25e820c58dbc9d3b0148a2022a4 (diff) | |
download | stable-diffusion-webui-gfx803-9320139bd8340e8b12c178fe80411c8e25f78d9e.tar.gz stable-diffusion-webui-gfx803-9320139bd8340e8b12c178fe80411c8e25f78d9e.tar.bz2 stable-diffusion-webui-gfx803-9320139bd8340e8b12c178fe80411c8e25f78d9e.zip |
support three extensions for preview instead of one: png, jpg, webp
Diffstat (limited to 'modules/ui_extra_networks.py')
-rw-r--r-- | modules/ui_extra_networks.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index 21c52287..3b476f3a 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -142,7 +142,11 @@ class ExtraNetworksPage: """
Find a preview PNG for a given path (without extension) and call link_preview on it.
"""
- for file in [path + ".png", path + ".preview.png"]:
+
+ preview_extensions = ["png", "jpg", "webp"]
+ potential_files = sum([[path + "." + ext, path + ".preview." + ext] for ext in preview_extensions], [])
+
+ for file in potential_files:
if os.path.isfile(file):
return self.link_preview(file)
|