mirror of
https://github.com/ivanch/tcc.git
synced 2025-08-25 15:21:49 +00:00
ajustando ASP com Flask
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import io
|
||||
from services.image import ImageService
|
||||
from static.image_helper import ImageHelper
|
||||
from flask import request, Response, Blueprint, jsonify, send_file
|
||||
|
||||
image_blueprint = Blueprint('image_blueprint', __name__)
|
||||
image_service = ImageService()
|
||||
|
||||
|
||||
@image_blueprint.route('/image/blur', methods=['POST'])
|
||||
def blur_image():
|
||||
radius = int(request.args.get('radius'))
|
||||
@@ -22,7 +21,7 @@ def blur_image():
|
||||
|
||||
@image_blueprint.route('/image/load-small-image', methods=['GET'])
|
||||
def get_simple_image():
|
||||
return send_file(image_service.get_simple_image(),
|
||||
return send_file(io.BytesIO(image_service.get_simple_image()),
|
||||
mimetype='image/png',
|
||||
as_attachment=True,
|
||||
download_name='small-image.png')
|
||||
@@ -30,7 +29,7 @@ def get_simple_image():
|
||||
|
||||
@image_blueprint.route('/image/load-big-image', methods=['GET'])
|
||||
def get_big_image():
|
||||
return send_file(image_service.get_big_image(),
|
||||
return send_file(io.BytesIO(image_service.get_big_image()),
|
||||
mimetype='image/png',
|
||||
as_attachment=True,
|
||||
download_name='big-image.png')
|
||||
@@ -39,3 +38,5 @@ def get_big_image():
|
||||
@image_blueprint.route('/image/save-big-image', methods=['POST'])
|
||||
def save_image():
|
||||
image_service.save_image(request.get_data())
|
||||
|
||||
return "OK", 200
|
||||
|
Reference in New Issue
Block a user