Added file format picker, changed re-scale interpolation, added deduplication
This commit is contained in:
@@ -4,155 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<title>Image Generator</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
font-family: "Segoe UI", sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
color: #333;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
|
||||
padding: 35px;
|
||||
margin: 40px 20px;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 200px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 26px;
|
||||
color: #4c2885;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
form {
|
||||
text-align: left;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: 600;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="number"],
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
margin-top: 4px;
|
||||
transition: border 0.2s;
|
||||
}
|
||||
|
||||
input:focus,
|
||||
textarea:focus {
|
||||
border-color: #764ba2;
|
||||
outline: none;
|
||||
}
|
||||
input:invalid textarea:invalid {
|
||||
border-color: #760000;
|
||||
outline: none;
|
||||
}
|
||||
textarea {
|
||||
resize: vertical;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.row input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: #ff6b6b;
|
||||
color: white;
|
||||
padding: 12px 20px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
margin-top: 30px;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #fa5252;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 20px;
|
||||
font-size: 14px;
|
||||
color: #444;
|
||||
min-height: 24px;
|
||||
}
|
||||
|
||||
.status-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 8px;
|
||||
opacity: 0;
|
||||
transform: scale(0.8);
|
||||
transition: opacity 0.3s, transform 0.3s;
|
||||
}
|
||||
|
||||
.status.show .status-icon {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
.fade-in {
|
||||
animation: fadeIn 0.5s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: scale(0.95);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 500px) {
|
||||
.row {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container fade-in">
|
||||
@@ -161,15 +13,11 @@
|
||||
<h1>Image Generator</h1>
|
||||
|
||||
<form id="imageForm">
|
||||
<label for="count">Images per Filename</label>
|
||||
<input
|
||||
type="number"
|
||||
id="count"
|
||||
name="count"
|
||||
min="1"
|
||||
value="1"
|
||||
required
|
||||
/>
|
||||
<label for="filetype">Image file format</label>
|
||||
<select id="filetype" name="filetype">
|
||||
<option value="Jpg">Jpeg</option>
|
||||
<option value="Png">PNG</option>
|
||||
</select>
|
||||
|
||||
<label for="width">Image Dimensions (px)</label>
|
||||
<div class="row">
|
||||
@@ -203,7 +51,7 @@
|
||||
</form>
|
||||
|
||||
<div class="status" id="status">
|
||||
<img id="statusIcon" class="status-icon" src="" alt="" />
|
||||
<div id="statusIcon" class="status-icon" src="" alt=""></div>
|
||||
<span id="statusText"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -219,15 +67,12 @@
|
||||
statusDiv.classList.add("show");
|
||||
|
||||
if (type === "success") {
|
||||
statusIcon.src = "https://img.icons8.com/color/48/ok--v1.png";
|
||||
statusIcon.innerHTML = "✅";
|
||||
} else if (type === "error") {
|
||||
statusIcon.src = "https://img.icons8.com/color/48/cancel--v1.png";
|
||||
statusIcon.innerHTML = "❌";
|
||||
} else {
|
||||
statusIcon.src =
|
||||
"https://img.icons8.com/color/48/medium-priority.png";
|
||||
statusIcon.innerHTML = "⏳";
|
||||
}
|
||||
|
||||
statusIcon.alt = type;
|
||||
};
|
||||
|
||||
form.addEventListener("submit", async (e) => {
|
||||
@@ -235,7 +80,7 @@
|
||||
showStatus("Generating images... Please wait.", "info");
|
||||
|
||||
const formData = {
|
||||
count: parseInt(form.count.value),
|
||||
filetype: form.filetype.value,
|
||||
width: Number(form.width.value),
|
||||
height: Number(form.height.value),
|
||||
filenames: form.filenames.value
|
||||
|
||||
Reference in New Issue
Block a user