This commit is contained in:
2025-12-02 17:02:20 -05:00
parent f82ba25160
commit 6423d1c1a2
49 changed files with 2320 additions and 349 deletions

View File

@@ -61,8 +61,8 @@ def upload():
format_extension_map = {'JPEG': '.jpg', 'PNG': '.png'}
extension = format_extension_map.get(original_format, '.png')
_id = str(uuid.uuid4())
filename = _id + extension
image_record = Image(extension=extension, permanent=perm, type=image_type)
filename = image_record.id + extension
filepath = os.path.abspath(os.path.join(UPLOAD_FOLDER, filename))
try:
@@ -76,10 +76,9 @@ def upload():
except Exception:
return jsonify({'error': 'Failed to save processed image'}), 500
image_record = Image(image_type, extension, permanent=perm, id=_id)
image_db.insert(image_record.to_dict())
return jsonify({'message': 'Image uploaded successfully', 'filename': filename, 'id': _id}), 200
return jsonify({'message': 'Image uploaded successfully', 'filename': filename, 'id': image_record.id}), 200
@image_api.route('/image/request/<id>', methods=['GET'])
def request_image(id):