This commit is contained in:
zaqxs123456 2024-10-24 23:25:46 +08:00
parent a94698b8e0
commit df777e86a0
4 changed files with 65 additions and 2 deletions

14
app.py
View File

@ -151,6 +151,20 @@ def api_images():
valid_images = [img for img in images if is_image_valid(os.path.join(app.config['UPLOAD_FOLDER'], img))] valid_images = [img for img in images if is_image_valid(os.path.join(app.config['UPLOAD_FOLDER'], img))]
return jsonify(valid_images) return jsonify(valid_images)
@app.route('/dump')
def dump():
if not session.get('logged_in'):
return redirect(url_for('login'))
dump_folder = 'dump_images' # Folder to store dump images
images = sorted(
os.listdir(dump_folder),
key=lambda x: os.path.getctime(os.path.join(dump_folder, x)),
reverse=True
)
valid_images = [img for img in images if is_image_valid(os.path.join(dump_folder, img))]
return render_template('dump.html', images=valid_images)
def emit_gallery_update(): def emit_gallery_update():
socketio.emit('update_gallery') socketio.emit('update_gallery')

View File

@ -15,6 +15,29 @@ h1 {
font-size: 24px; font-size: 24px;
text-align: center; text-align: center;
} }
.button-container {
display: flex;
justify-content: center;
gap: 10px;
margin-bottom: 20px;
padding: 20px;
}
.button {
padding: 10px 50px;
background-color: #ebbbff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s, transform 0.2s;
font-size: 16px;
text-decoration: none;
text-align: center;
}
.button:hover {
background-color: #e099ff;
transform: scale(1.02);
}
.gallery-container { .gallery-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

22
templates/dump.html Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<title>Pumpkin Gallery🎃</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='gallery_styles.css') }}">
</head>
<body>
<div class="button-container">
<a href="{{ url_for('gallery') }}" class="button">🤺🤺🤺</a>
<a href="{{ url_for('dump') }}" class="button">🎃🎃🎃</a>
</div>
<h1>Pumpkin Gallery🎃</h1>
<div class="gallery-container">
{% for image in images %}
<a href="#" data-original="{{ url_for('uploaded_file', filename=image) }}" target="_blank">
<img class="responsive-img" src="{{ url_for('cached_file', filename=image) }}" alt="{{ image }}">
</a>
{% endfor %}
</div>
</body>
</html>

View File

@ -1,13 +1,17 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Image Gallery</title> <title>Fencing Gallery🤺</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css') }}"> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='gallery_styles.css') }}"> <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> <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
</head> </head>
<body> <body>
<h1>Image Gallery</h1> <div class="button-container">
<a href="{{ url_for('gallery') }}" class="button">🤺🤺🤺</a>
<a href="{{ url_for('dump') }}" class="button">🎃🎃🎃</a>
</div>
<h1>Fencing Gallery🤺</h1>
<div class="gallery-container" id="gallery-container"> <div class="gallery-container" id="gallery-container">
{% for batch in batches %} {% for batch in batches %}
{% set batch_number = batch[0].split('_')[0] if batch and '_' in batch[0] else 'unstructured' %} {% set batch_number = batch[0].split('_')[0] if batch and '_' in batch[0] else 'unstructured' %}