34 lines
1.2 KiB
HTML
34 lines
1.2 KiB
HTML
|
<!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>
|