Skip to content

Commit 6484968

Browse files
authored
Merge pull request #35 from idrirap/dev/issue34
fix: sometimes the preview image extension is prefixed with '.preview'
2 parents b02bea5 + 9a212d1 commit 6484968

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-lora-auto-trigger-words"
33
description = "The aim of these custom nodes is to get an easy access to the tags used to trigger a lora / lycoris. Extract the tags from civitai or from the safetensors metadatas when available."
4-
version = "1.0.1"
4+
version = "1.0.2"
55
license = "MIT"
66

77
[project.urls]

utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ def get_preview_path(name, type):
1515

1616
file_path_no_ext = os.path.splitext(file_path)[0]
1717
item_image=None
18-
for ext in ["png", "jpg", "jpeg", "preview.png"]:
19-
has_image = os.path.isfile(file_path_no_ext + "." + ext)
20-
if has_image:
21-
item_image = f"{file_name}.{ext}"
18+
for ext in ["png", "jpg", "jpeg", "gif"]:
19+
if item_image is not None:
2220
break
21+
for ext2 in ["", ".preview"]:
22+
has_image = os.path.isfile(file_path_no_ext + ext2 + "." + ext)
23+
if has_image:
24+
item_image = f"{file_name}{ext2}.{ext}"
25+
break
2326

2427
return has_image, item_image
2528

0 commit comments

Comments
 (0)