15 lines
396 B
Python
15 lines
396 B
Python
import os
|
|
from flask import Blueprint, current_app, send_file, abort
|
|
|
|
bp = Blueprint("proxy", __name__)
|
|
|
|
|
|
@bp.route("/thumb/<asset_id>")
|
|
def thumb(asset_id):
|
|
cfg = current_app.config["APP_CONFIG"]
|
|
safe = os.path.basename(asset_id)
|
|
path = os.path.join(cfg.thumbs_dir, f"{safe}.jpg")
|
|
if not os.path.exists(path):
|
|
abort(404)
|
|
return send_file(path, mimetype="image/jpeg")
|