Skip to content

Commit

Permalink
support jsbroks#560
Browse files Browse the repository at this point in the history
  • Loading branch information
TakanoTaiga committed May 22, 2024
1 parent bb86a45 commit e76a6db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/webserver/api/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
image_download.add_argument('thumbnail', type=bool, default=False)
image_download.add_argument('width', type=int)
image_download.add_argument('height', type=int)
image_download.add_argument('original', type=bool, default=False)

copy_annotations = reqparse.RequestParser()
copy_annotations.add_argument('category_ids', location='json', type=list,
Expand Down Expand Up @@ -113,11 +114,14 @@ def get(self, image_id):
args = image_download.parse_args()
as_attachment = args.get('asAttachment')
thumbnail = args.get('thumbnail')
original = args.get('original')

image = current_user.images.filter(id=image_id, deleted=False).first()

if image is None:
return {'success': False}, 400
if original:
return send_file(image.path, attachment_filename=image.file_name, as_attachment=as_attachment)

width = args.get('width')
height = args.get('height')
Expand Down

0 comments on commit e76a6db

Please sign in to comment.