new identifier and added creation folder logic

This commit is contained in:
Manuel Hude
2020-11-30 12:47:32 +01:00
parent e1a1cb25fc
commit 2e58c64ced
3 changed files with 12 additions and 4 deletions
+6 -1
View File
@@ -54,7 +54,12 @@ def get_image(identifier):
b64encoded_image = unwrap_file(payload['image_data'])
goal_folder_name = "images_fetch"
path = "../../"+goal_folder_name+"/"+payload['metadata']['filename']
goal_folder_path = os.path.sep.join(os.path.abspath(__file__).split(os.path.sep)[:-3]) + os.path.sep + goal_folder_name
goal_folder_path = os.path.sep.join(os.path.abspath(__file__).split(os.path.sep)[:-3]) + os.path.sep + goal_folder_name
if not os.path.isdir(goal_folder_path):
os.mkdir(goal_folder_path)
out = open(path, 'wb')
out.write(b64encoded_image)
out.close()