support three extensions for preview instead of one: png, jpg, webp
This commit is contained in:
parent
ce68ab8d0d
commit
9320139bd8
1 changed files with 5 additions and 1 deletions
|
@ -142,7 +142,11 @@ class ExtraNetworksPage:
|
||||||
"""
|
"""
|
||||||
Find a preview PNG for a given path (without extension) and call link_preview on it.
|
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):
|
if os.path.isfile(file):
|
||||||
return self.link_preview(file)
|
return self.link_preview(file)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue