mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-04-28 19:23:41 +01:00
add /gallery to show all generated images
This commit is contained in:
parent
290c1badb4
commit
6cc30bd2d0
@ -27,6 +27,12 @@ def index():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/gallery")
|
||||||
|
def gallery():
|
||||||
|
images = [f for f in os.listdir(image_folder) if f.lower().endswith(('png', 'jpg', 'jpeg', 'gif'))]
|
||||||
|
return render_template("gallery.html", images=images)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/images/<filename>")
|
@app.route("/images/<filename>")
|
||||||
def images(filename):
|
def images(filename):
|
||||||
return send_from_directory(image_folder, filename)
|
return send_from_directory(image_folder, filename)
|
||||||
|
71
templates/gallery.html
Normal file
71
templates/gallery.html
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Image Archive</title>
|
||||||
|
<style>
|
||||||
|
.gallery {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
.gallery img {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
/* Lightbox styles */
|
||||||
|
.lightbox {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.8);
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.lightbox img {
|
||||||
|
max-width: 90%;
|
||||||
|
max-height: 90%;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.lightbox .close {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
right: 30px;
|
||||||
|
font-size: 30px;
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Image Archive</h1>
|
||||||
|
<div class="gallery">
|
||||||
|
{% for image in images %}
|
||||||
|
<img src="{{ url_for('images', filename=image) }}" alt="Image" onclick="openLightbox(this.src)">
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Lightbox -->
|
||||||
|
<div class="lightbox" id="lightbox">
|
||||||
|
<span class="close" onclick="closeLightbox()">×</span>
|
||||||
|
<img id="lightbox-img" src="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function openLightbox(src) {
|
||||||
|
document.getElementById("lightbox-img").src = src;
|
||||||
|
document.getElementById("lightbox").style.display = "flex";
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeLightbox() {
|
||||||
|
document.getElementById("lightbox").style.display = "none";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Latest Image</title>
|
<title>AI Image of the day</title>
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user