mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-05-30 00:25:06 +01:00
182 lines
4.8 KiB
HTML
182 lines
4.8 KiB
HTML
<!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>
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
body {
|
||
background-color: black;
|
||
color: white;
|
||
font-family: sans-serif;
|
||
padding: 2rem;
|
||
}
|
||
|
||
h1 {
|
||
text-align: center;
|
||
margin-bottom: 2rem;
|
||
}
|
||
|
||
.gallery {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
|
||
gap: 20px;
|
||
}
|
||
|
||
.gallery img {
|
||
width: 100%;
|
||
height: auto;
|
||
border-radius: 10px;
|
||
cursor: pointer;
|
||
transition: transform 0.2s ease;
|
||
}
|
||
|
||
.gallery img:hover {
|
||
transform: scale(1.02);
|
||
}
|
||
|
||
/* Lightbox styles */
|
||
.lightbox {
|
||
display: none;
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
background: rgba(0, 0, 0, 0.9);
|
||
justify-content: center;
|
||
align-items: center;
|
||
flex-direction: column;
|
||
z-index: 999;
|
||
}
|
||
|
||
.lightbox img {
|
||
max-width: 90%;
|
||
max-height: 80%;
|
||
border-radius: 10px;
|
||
}
|
||
|
||
.lightbox .close {
|
||
position: absolute;
|
||
top: 20px;
|
||
right: 30px;
|
||
font-size: 30px;
|
||
color: white;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.arrow {
|
||
position: absolute;
|
||
top: 50%;
|
||
font-size: 40px;
|
||
color: white;
|
||
cursor: pointer;
|
||
user-select: none;
|
||
transform: translateY(-50%);
|
||
}
|
||
|
||
.arrow.left {
|
||
left: 20px;
|
||
}
|
||
|
||
.arrow.right {
|
||
right: 20px;
|
||
}
|
||
|
||
#lightbox-prompt {
|
||
color: #ccc;
|
||
font-family: monospace;
|
||
white-space: pre-wrap;
|
||
background: rgba(0, 0, 0, 0.6);
|
||
padding: 10px 20px;
|
||
border-radius: 10px;
|
||
max-width: 80%;
|
||
text-align: left;
|
||
margin-top: 20px;
|
||
}
|
||
|
||
.button-group {
|
||
display: flex;
|
||
justify-content: center;
|
||
margin-top: 2rem;
|
||
}
|
||
|
||
.button-link {
|
||
background: #333;
|
||
color: white;
|
||
text-decoration: none;
|
||
padding: 10px 20px;
|
||
border-radius: 8px;
|
||
font-size: 16px;
|
||
cursor: pointer;
|
||
transition: background 0.3s;
|
||
display: inline-block;
|
||
text-align: center;
|
||
}
|
||
|
||
.button-link:hover {
|
||
background: #555;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<h1>Image Archive</h1>
|
||
<div class="gallery">
|
||
{% for image in images %}
|
||
<img src="{{ url_for('images', filename='thumbnails/' + image.filename) }}"
|
||
data-fullsrc="{{ url_for('images', filename=image.filename) }}" data-filename="{{ image.filename }}"
|
||
loading="lazy" onclick="openLightbox(this)">
|
||
|
||
{% endfor %}
|
||
</div>
|
||
<div class="button-group">
|
||
<a href="/" class="button-link">Back</a>
|
||
</div>
|
||
|
||
|
||
<!-- Lightbox -->
|
||
<div class="lightbox" id="lightbox">
|
||
<span class="close" onclick="closeLightbox()">×</span>
|
||
<span class="arrow left" onclick="prevImage()">❮</span>
|
||
<img id="lightbox-img" src="">
|
||
<p id="lightbox-prompt"></p>
|
||
<span class="arrow right" onclick="nextImage()">❯</span>
|
||
</div>
|
||
|
||
<script>
|
||
function openLightbox(imgEl) {
|
||
const filename = imgEl.dataset.filename;
|
||
const fullsrc = imgEl.dataset.fullsrc;
|
||
const lightbox = document.getElementById("lightbox");
|
||
|
||
// show the image immediately
|
||
document.getElementById("lightbox-img").src = fullsrc;
|
||
document.getElementById("lightbox-prompt").textContent = "Loading…";
|
||
lightbox.style.display = "flex";
|
||
|
||
// fetch details on‑demand
|
||
fetch(`/image-details/${encodeURIComponent(filename)}`)
|
||
.then(r => r.ok ? r.json() : Promise.reject())
|
||
.then(data => {
|
||
document.getElementById("lightbox-prompt").textContent =
|
||
`Model: ${data.model}\n\n${data.prompt}`;
|
||
})
|
||
.catch(() => {
|
||
document.getElementById("lightbox-prompt").textContent =
|
||
"Couldn’t load details.";
|
||
});
|
||
}
|
||
function closeLightbox() { document.getElementById("lightbox").style.display = "none"; }
|
||
</script>
|
||
|
||
</body>
|
||
|
||
</html> |