修改添加备注时显示图片的一处bug

This commit is contained in:
weiye.wang 2024-06-20 21:25:32 +08:00
parent 0f71d58209
commit 8b1d7d1d4c
1 changed files with 1 additions and 0 deletions

View File

@ -52,6 +52,7 @@ def show_image():
shutil.copy(f"临时文件/pics/ID{id}-{currentdate}-{currenttime}-1.png",f"static/{id}.png") shutil.copy(f"临时文件/pics/ID{id}-{currentdate}-{currenttime}-1.png",f"static/{id}.png")
with open(f"static/{id}.png","rb") as f: with open(f"static/{id}.png","rb") as f:
image_data = f.read() image_data = f.read()
mycursor.execute("DELETE FROM pics WHERE ID = %s;",(id,))
mycursor.execute("INSERT INTO pics (ID,pic,date,hash) VALUES (%s,%s,%s,%s)",(id,image_data,currentdate,content_hash)) mycursor.execute("INSERT INTO pics (ID,pic,date,hash) VALUES (%s,%s,%s,%s)",(id,image_data,currentdate,content_hash))
mydb.commit() mydb.commit()
mydb.close() mydb.close()