mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-06-26 18:29:13 +01:00
16 lines
502 B
Python
16 lines
502 B
Python
from flask import Blueprint, render_template
|
|
import os
|
|
|
|
bp = Blueprint("gallery_routes", __name__)
|
|
image_folder = "./output"
|
|
|
|
@bp.route("/images", methods=["GET"])
|
|
def gallery():
|
|
images = [
|
|
{"filename": f}
|
|
for f in os.listdir(image_folder)
|
|
if f.lower().endswith(("png", "jpg", "jpeg", "gif"))
|
|
]
|
|
images = sorted(images, key=lambda x: os.path.getmtime(os.path.join(image_folder, x["filename"])), reverse=True)
|
|
return render_template("gallery.html", images=images)
|