Ajout des fichiers de configuration et du code pour le redimensionnement d'images avec Bottle et Pillow
This commit is contained in:
116
views/index.tpl
Normal file
116
views/index.tpl
Normal file
@@ -0,0 +1,116 @@
|
||||
<!-- views/index.tpl -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Réduction d'images</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
background: #f0f4f8;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
background: white;
|
||||
padding: 30px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 8px 16px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
color: #1e3a8a;
|
||||
}
|
||||
|
||||
label {
|
||||
margin-top: 20px;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
}
|
||||
|
||||
input, select {
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
font-size: 15px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-top: 30px;
|
||||
width: 100%;
|
||||
background-color: #1e40af;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 15px;
|
||||
font-size: 16px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #1d4ed8;
|
||||
}
|
||||
|
||||
.loader {
|
||||
display: none;
|
||||
text-align: center;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.loader div {
|
||||
border: 8px solid #f3f3f3;
|
||||
border-top: 8px solid #2563eb;
|
||||
border-radius: 50%;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>📷 Réduction d’images</h1>
|
||||
<form id="uploadForm" action="/upload" method="post" enctype="multipart/form-data">
|
||||
<label>Dossier d'images :</label>
|
||||
<input type="file" name="files" webkitdirectory multiple required>
|
||||
|
||||
<label>Ratio de réduction :</label>
|
||||
<select name="ratio" required>
|
||||
<option value="1">1 (original)</option>
|
||||
<option value="1.5">1.5 (réduction légère)</option>
|
||||
<option value="2" selected>2 (moitié)</option>
|
||||
<option value="3">3 (forte)</option>
|
||||
<option value="4">4 (très forte)</option>
|
||||
</select>
|
||||
|
||||
<button type="submit">📥 Réduire et télécharger</button>
|
||||
</form>
|
||||
|
||||
<div class="loader" id="loader">
|
||||
<p>Traitement des images en cours... Patientez ⏳</p>
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const form = document.getElementById("uploadForm");
|
||||
const loader = document.getElementById("loader");
|
||||
|
||||
form.addEventListener("submit", function() {
|
||||
form.style.display = "none";
|
||||
loader.style.display = "block";
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
96
views/result.tpl
Normal file
96
views/result.tpl
Normal file
@@ -0,0 +1,96 @@
|
||||
<!-- views/result.tpl -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Téléchargement prêt</title>
|
||||
|
||||
<!-- Lightbox CSS -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.4/css/lightbox.min.css" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
background: #f0f4f8;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: auto 10%;
|
||||
background: #ffffff;
|
||||
padding: 30px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 8px 20px rgba(0,0,0,0.08);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #1e3a8a;
|
||||
}
|
||||
|
||||
.info {
|
||||
background-color: #f1f5f9;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.gallery {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
justify-content: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.gallery a img {
|
||||
width: 80px;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.gallery a img:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
a.download-btn {
|
||||
display: inline-block;
|
||||
background-color: #2563eb;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 15px 25px;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.download-btn:hover {
|
||||
background-color: #1d4ed8;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>📦 Vos images sont prêtes !</h1>
|
||||
|
||||
<div class="info">
|
||||
<p><strong>{{ count }}</strong> images ont été redimensionnées</p>
|
||||
<p>Ratio appliqué : <strong>{{ ratio }}</strong></p>
|
||||
</div>
|
||||
|
||||
<div class="gallery">
|
||||
% for img in images:
|
||||
<a href="/resized/{{ img }}" data-lightbox="gallery" data-title="{{ img }}">
|
||||
<img src="/resized/{{ img }}" alt="{{ img }}">
|
||||
</a>
|
||||
% end
|
||||
</div>
|
||||
|
||||
<a class="download-btn" href="/download">⬇️ Télécharger les images réduites</a>
|
||||
</div>
|
||||
|
||||
<!-- Lightbox JS -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.4/js/lightbox.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user