sd_image_selector/templates/gallery.html

34 lines
1.2 KiB
HTML
Raw Normal View History

2024-10-21 10:17:56 +00:00
<!DOCTYPE html>
<html>
<head>
<title>Image Gallery</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='gallery_styles.css') }}">
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
</head>
<body>
<h1>Image Gallery</h1>
<div class="gallery-container" id="gallery-container">
{% for image in images %}
<img class="responsive-img" src="{{ url_for('uploaded_file', filename=image) }}" alt="{{ image }}">
{% endfor %}
</div>
<script>
var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port);
socket.on('update_gallery', function() {
location.reload();
});
document.addEventListener("DOMContentLoaded", function() {
var images = document.querySelectorAll('.responsive-img');
images.forEach(function(img) {
img.addEventListener('load', function() {
img.classList.add('loaded');
});
if (img.complete) {
img.classList.add('loaded');
}
});
});
</script>
</body>
</html>