2025-04-01 12:12:15 +01:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-01 12:12:15 +01:00
|
|
|
|
<head>
|
2025-05-17 10:32:28 +01:00
|
|
|
|
<meta charset="UTF-8" />
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
2025-04-01 12:12:15 +01:00
|
|
|
|
<title>Image Archive</title>
|
|
|
|
|
<style>
|
2025-04-24 22:15:13 +01:00
|
|
|
|
* {
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-24 22:15:13 +01:00
|
|
|
|
body {
|
|
|
|
|
background-color: black;
|
|
|
|
|
color: white;
|
|
|
|
|
font-family: sans-serif;
|
|
|
|
|
padding: 2rem;
|
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-24 22:15:13 +01:00
|
|
|
|
h1 {
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin-bottom: 2rem;
|
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-01 12:12:15 +01:00
|
|
|
|
.gallery {
|
|
|
|
|
display: grid;
|
2025-04-01 16:56:10 +01:00
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
|
2025-04-24 22:15:13 +01:00
|
|
|
|
gap: 20px;
|
2025-04-01 12:12:15 +01:00
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-01 12:12:15 +01:00
|
|
|
|
.gallery img {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: auto;
|
2025-04-24 22:15:13 +01:00
|
|
|
|
border-radius: 10px;
|
2025-04-01 12:12:15 +01:00
|
|
|
|
cursor: pointer;
|
2025-04-24 22:15:13 +01:00
|
|
|
|
transition: transform 0.2s ease;
|
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-24 22:15:13 +01:00
|
|
|
|
.gallery img:hover {
|
|
|
|
|
transform: scale(1.02);
|
2025-04-01 12:12:15 +01:00
|
|
|
|
}
|
2025-04-24 22:15:13 +01:00
|
|
|
|
|
2025-04-01 12:12:15 +01:00
|
|
|
|
/* Lightbox styles */
|
|
|
|
|
.lightbox {
|
|
|
|
|
display: none;
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
2025-04-24 22:15:13 +01:00
|
|
|
|
background: rgba(0, 0, 0, 0.9);
|
2025-04-01 12:12:15 +01:00
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
2025-04-01 16:51:43 +01:00
|
|
|
|
flex-direction: column;
|
2025-04-24 22:15:13 +01:00
|
|
|
|
z-index: 999;
|
2025-04-01 12:12:15 +01:00
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-01 12:12:15 +01:00
|
|
|
|
.lightbox img {
|
|
|
|
|
max-width: 90%;
|
2025-04-24 22:15:13 +01:00
|
|
|
|
max-height: 80%;
|
|
|
|
|
border-radius: 10px;
|
2025-04-01 12:12:15 +01:00
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-01 12:12:15 +01:00
|
|
|
|
.lightbox .close {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 20px;
|
|
|
|
|
right: 30px;
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
color: white;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-01 16:51:43 +01:00
|
|
|
|
.arrow {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 50%;
|
|
|
|
|
font-size: 40px;
|
|
|
|
|
color: white;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
user-select: none;
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-01 16:51:43 +01:00
|
|
|
|
.arrow.left {
|
|
|
|
|
left: 20px;
|
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-01 16:51:43 +01:00
|
|
|
|
.arrow.right {
|
|
|
|
|
right: 20px;
|
|
|
|
|
}
|
2025-04-24 16:55:07 +01:00
|
|
|
|
|
|
|
|
|
#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;
|
|
|
|
|
}
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
|
|
|
|
.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;
|
|
|
|
|
}
|
2025-05-17 10:37:10 +01:00
|
|
|
|
|
|
|
|
|
@media (max-width: 600px) {
|
|
|
|
|
body {
|
|
|
|
|
padding: 1rem;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.gallery {
|
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
|
|
|
gap: 12px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.gallery img {
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.lightbox .close {
|
|
|
|
|
font-size: 36px;
|
|
|
|
|
top: 10px;
|
|
|
|
|
right: 15px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.arrow {
|
|
|
|
|
font-size: 48px;
|
|
|
|
|
top: 50%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#lightbox-prompt {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
max-width: 90%;
|
|
|
|
|
padding: 8px 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.button-link {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
padding: 8px 16px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-04-01 12:12:15 +01:00
|
|
|
|
</style>
|
|
|
|
|
</head>
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-04-01 12:12:15 +01:00
|
|
|
|
<body>
|
|
|
|
|
<h1>Image Archive</h1>
|
2025-04-25 10:13:03 +01:00
|
|
|
|
|
2025-05-17 10:32:28 +01:00
|
|
|
|
<!-- Empty gallery container; images will be loaded incrementally -->
|
|
|
|
|
<div class="gallery" id="gallery"></div>
|
|
|
|
|
|
2025-05-15 09:26:10 +01:00
|
|
|
|
<div class="button-group">
|
|
|
|
|
<a href="/" class="button-link">Back</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-04-01 12:12:15 +01:00
|
|
|
|
<!-- Lightbox -->
|
|
|
|
|
<div class="lightbox" id="lightbox">
|
|
|
|
|
<span class="close" onclick="closeLightbox()">×</span>
|
2025-04-01 16:51:43 +01:00
|
|
|
|
<span class="arrow left" onclick="prevImage()">❮</span>
|
2025-05-17 10:32:28 +01:00
|
|
|
|
<img id="lightbox-img" src="" />
|
2025-04-24 22:15:13 +01:00
|
|
|
|
<p id="lightbox-prompt"></p>
|
2025-04-01 16:51:43 +01:00
|
|
|
|
<span class="arrow right" onclick="nextImage()">❯</span>
|
2025-04-01 12:12:15 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
2025-05-17 10:32:28 +01:00
|
|
|
|
<!-- Pass image filenames from Flask to JS -->
|
|
|
|
|
<script>
|
|
|
|
|
const allImages = [
|
|
|
|
|
{% for image in images %}
|
2025-05-17 10:37:10 +01:00
|
|
|
|
{ filename: "{{ image.filename }}" },
|
|
|
|
|
{% endfor %}
|
2025-05-17 10:32:28 +01:00
|
|
|
|
];
|
|
|
|
|
</script>
|
|
|
|
|
|
2025-04-01 12:12:15 +01:00
|
|
|
|
<script>
|
2025-05-17 10:32:28 +01:00
|
|
|
|
const gallery = document.getElementById('gallery');
|
|
|
|
|
const batchSize = 6; // images to load per batch
|
|
|
|
|
let loadedCount = 0;
|
2025-05-17 10:29:53 +01:00
|
|
|
|
let currentIndex = 0;
|
2025-05-17 10:32:28 +01:00
|
|
|
|
const detailsCache = {}; // Cache for image details
|
|
|
|
|
|
|
|
|
|
function createImageElement(image) {
|
|
|
|
|
const img = document.createElement('img');
|
|
|
|
|
img.src = `/images/thumbnails/${image.filename}`;
|
|
|
|
|
img.dataset.fullsrc = `/images/${image.filename}`;
|
|
|
|
|
img.dataset.filename = image.filename;
|
|
|
|
|
img.loading = 'lazy';
|
|
|
|
|
img.style.cursor = 'pointer';
|
|
|
|
|
img.style.borderRadius = '10px';
|
|
|
|
|
img.addEventListener('click', () => openLightbox(img));
|
|
|
|
|
return img;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loadNextBatch() {
|
|
|
|
|
const nextImages = allImages.slice(loadedCount, loadedCount + batchSize);
|
|
|
|
|
nextImages.forEach(image => {
|
|
|
|
|
const imgEl = createImageElement(image);
|
|
|
|
|
gallery.appendChild(imgEl);
|
|
|
|
|
});
|
|
|
|
|
loadedCount += nextImages.length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Load initial batch
|
|
|
|
|
loadNextBatch();
|
|
|
|
|
|
|
|
|
|
// Load more images when scrolling near bottom
|
|
|
|
|
window.addEventListener('scroll', () => {
|
|
|
|
|
if (loadedCount >= allImages.length) return; // all loaded
|
|
|
|
|
if ((window.innerHeight + window.scrollY) >= (document.body.offsetHeight - 100)) {
|
|
|
|
|
loadNextBatch();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Get current images in gallery for lightbox navigation
|
|
|
|
|
function getGalleryImages() {
|
|
|
|
|
return Array.from(gallery.querySelectorAll('img'));
|
|
|
|
|
}
|
2025-05-17 10:29:53 +01:00
|
|
|
|
|
2025-05-17 10:25:46 +01:00
|
|
|
|
function openLightbox(imgEl) {
|
2025-05-17 10:32:28 +01:00
|
|
|
|
const images = getGalleryImages();
|
2025-05-17 10:29:53 +01:00
|
|
|
|
currentIndex = images.indexOf(imgEl);
|
|
|
|
|
showImageAndLoadDetails(currentIndex);
|
|
|
|
|
document.getElementById("lightbox").style.display = "flex";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showImageAndLoadDetails(index) {
|
2025-05-17 10:32:28 +01:00
|
|
|
|
const images = getGalleryImages();
|
2025-05-17 10:29:53 +01:00
|
|
|
|
const imgEl = images[index];
|
2025-05-17 10:25:46 +01:00
|
|
|
|
const filename = imgEl.dataset.filename;
|
|
|
|
|
const fullsrc = imgEl.dataset.fullsrc;
|
|
|
|
|
|
|
|
|
|
document.getElementById("lightbox-img").src = fullsrc;
|
2025-05-17 10:29:53 +01:00
|
|
|
|
|
|
|
|
|
if (detailsCache[filename]) {
|
|
|
|
|
document.getElementById("lightbox-prompt").textContent =
|
|
|
|
|
`Model: ${detailsCache[filename].model}\n\n${detailsCache[filename].prompt}`;
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementById("lightbox-prompt").textContent = "Loading…";
|
|
|
|
|
|
|
|
|
|
fetch(`/image-details/${encodeURIComponent(filename)}`)
|
|
|
|
|
.then(response => {
|
|
|
|
|
if (!response.ok) throw new Error("Network response was not ok");
|
|
|
|
|
return response.json();
|
|
|
|
|
})
|
|
|
|
|
.then(data => {
|
|
|
|
|
detailsCache[filename] = data; // Cache the data
|
|
|
|
|
document.getElementById("lightbox-prompt").textContent =
|
|
|
|
|
`Model: ${data.model}\n\n${data.prompt}`;
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
document.getElementById("lightbox-prompt").textContent = "Couldn’t load details.";
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function nextImage() {
|
2025-05-17 10:32:28 +01:00
|
|
|
|
const images = getGalleryImages();
|
2025-05-17 10:29:53 +01:00
|
|
|
|
currentIndex = (currentIndex + 1) % images.length;
|
|
|
|
|
showImageAndLoadDetails(currentIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function prevImage() {
|
2025-05-17 10:32:28 +01:00
|
|
|
|
const images = getGalleryImages();
|
2025-05-17 10:29:53 +01:00
|
|
|
|
currentIndex = (currentIndex - 1 + images.length) % images.length;
|
|
|
|
|
showImageAndLoadDetails(currentIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function closeLightbox() {
|
|
|
|
|
document.getElementById("lightbox").style.display = "none";
|
|
|
|
|
}
|
2025-04-01 12:12:15 +01:00
|
|
|
|
</script>
|
|
|
|
|
</body>
|
2025-05-15 09:26:10 +01:00
|
|
|
|
|
2025-05-17 10:37:10 +01:00
|
|
|
|
</html>
|