mirror of
https://github.com/idrirap/ComfyUI-Lora-Auto-Trigger-Words.git
synced 2026-03-21 21:22:12 -03:00
fix: sometimes the preview image extension is prefixed with '.preview'
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "comfyui-lora-auto-trigger-words"
|
name = "comfyui-lora-auto-trigger-words"
|
||||||
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."
|
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."
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
|||||||
9
utils.py
9
utils.py
@@ -15,10 +15,13 @@ def get_preview_path(name, type):
|
|||||||
|
|
||||||
file_path_no_ext = os.path.splitext(file_path)[0]
|
file_path_no_ext = os.path.splitext(file_path)[0]
|
||||||
item_image=None
|
item_image=None
|
||||||
for ext in ["png", "jpg", "jpeg", "preview.png"]:
|
for ext in ["png", "jpg", "jpeg", "gif"]:
|
||||||
has_image = os.path.isfile(file_path_no_ext + "." + ext)
|
if item_image is not None:
|
||||||
|
break
|
||||||
|
for ext2 in ["", ".preview"]:
|
||||||
|
has_image = os.path.isfile(file_path_no_ext + ext2 + "." + ext)
|
||||||
if has_image:
|
if has_image:
|
||||||
item_image = f"{file_name}.{ext}"
|
item_image = f"{file_name}{ext2}.{ext}"
|
||||||
break
|
break
|
||||||
|
|
||||||
return has_image, item_image
|
return has_image, item_image
|
||||||
|
|||||||
Reference in New Issue
Block a user