格式化文件
This commit is contained in:
parent
4b0abf32d0
commit
129eff10d2
@ -333,15 +333,10 @@ def get_img():
|
|||||||
return ReJson(1003, msg="Unsupported method")
|
return ReJson(1003, msg="Unsupported method")
|
||||||
if not img_path:
|
if not img_path:
|
||||||
return ReJson(1002)
|
return ReJson(1002)
|
||||||
print(img_path)
|
|
||||||
wx_path = read_session(g.sf, "wx_path")
|
wx_path = read_session(g.sf, "wx_path")
|
||||||
img_tmp_path = os.path.join(g.tmp_path, "img")
|
img_tmp_path = os.path.join(g.tmp_path, "img")
|
||||||
img_path_all = os.path.join(wx_path, img_path)
|
img_path_all = os.path.join(wx_path, img_path)
|
||||||
|
|
||||||
print(img_path_all)
|
|
||||||
print(os.path.exists(img_path_all))
|
|
||||||
|
|
||||||
|
|
||||||
if os.path.exists(img_path_all):
|
if os.path.exists(img_path_all):
|
||||||
fomt, md5, out_bytes = read_img_dat(img_path_all)
|
fomt, md5, out_bytes = read_img_dat(img_path_all)
|
||||||
imgsavepath = os.path.join(img_tmp_path, img_path+"_"+".".join([md5, fomt]))
|
imgsavepath = os.path.join(img_tmp_path, img_path+"_"+".".join([md5, fomt]))
|
||||||
@ -349,9 +344,6 @@ def get_img():
|
|||||||
os.makedirs(os.path.dirname(imgsavepath))
|
os.makedirs(os.path.dirname(imgsavepath))
|
||||||
with open(imgsavepath, "wb") as f:
|
with open(imgsavepath, "wb") as f:
|
||||||
f.write(out_bytes)
|
f.write(out_bytes)
|
||||||
# out_bytes = base64.b64encode(out_bytes).decode("utf-8")
|
|
||||||
# out_bytes = f"data:{fomt};base64,{out_bytes}"
|
|
||||||
# return ReJson(0, out_bytes)
|
|
||||||
return send_file(imgsavepath)
|
return send_file(imgsavepath)
|
||||||
else:
|
else:
|
||||||
return ReJson(1001, body=img_path_all)
|
return ReJson(1001, body=img_path_all)
|
||||||
|
Loading…
Reference in New Issue
Block a user