rogerxavier commited on
Commit
bc39f3a
1 Parent(s): de32832

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +3 -3
api.py CHANGED
@@ -266,8 +266,8 @@ def get_cover_image():
266
 
267
  #请求任意图片路径就返回这个路径的图片方便随时查看
268
 
269
- @app.get("/{file_name}")
270
- def get_image(file_name: str = Path(...)):
271
- image_dir = "/"
272
  file_path = os.path.join(image_dir, file_name)
273
  return FileResponse(file_path)
 
266
 
267
  #请求任意图片路径就返回这个路径的图片方便随时查看
268
 
269
+ @app.get("/get_image/{directory}/{file_name}")
270
+ def get_image(directory: str, file_name: str = Path(...)):
271
+ image_dir = f"/{directory}" # 指定子目录
272
  file_path = os.path.join(image_dir, file_name)
273
  return FileResponse(file_path)