1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 15:04:50 +08:00

can specify a subfolder in the SaveImage node

This commit is contained in:
m957ymj75urz
2023-03-12 19:51:39 +01:00
parent 6d6758e9e4
commit 195d7aec9f
3 changed files with 19 additions and 10 deletions

View File

@@ -109,15 +109,18 @@ class PromptServer():
return web.Response(status=400)
@routes.get("/view/{file}")
@routes.get("/view")
async def view_image(request):
if "file" in request.match_info:
if "file" in request.rel_url.query:
type = request.rel_url.query.get("type", "output")
if type != "output" and type != "input":
return web.Response(status=400)
output_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), type)
file = request.match_info["file"]
if "subfolder" in request.rel_url.query:
output_dir = os.path.join(output_dir, request.rel_url.query["subfolder"])
file = request.rel_url.query["file"]
file = os.path.basename(file)
file = os.path.join(output_dir, file)
if os.path.isfile(file):