python-gallery/gallery/api.py
Michał 44a6712b6e Image upload added
Added temporary fix to loading images on the home page
Fix api.py for requesting images
Minor tweaks to default theme
2023-01-10 18:12:55 +00:00

13 lines
449 B
Python

from flask import Blueprint, render_template, current_app, send_from_directory
from werkzeug.utils import secure_filename
import os
blueprint = Blueprint('viewsbp', __name__, url_prefix='/')
@blueprint.route('/uploads/<quality>/<file>')
def uploads(quality, file):
dir = os.path.join(current_app.config['UPLOAD_FOLDER'], secure_filename(quality))
file = secure_filename(file)
return send_from_directory(dir, file, as_attachment=True)