Update index.html
Browse files- index.html +9 -61
index.html
CHANGED
@@ -5,67 +5,7 @@
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Image Format Converter</title>
|
7 |
<style>
|
8 |
-
|
9 |
-
font-family: 'Arial', sans-serif;
|
10 |
-
max-width: 600px;
|
11 |
-
margin: 20px auto;
|
12 |
-
padding: 20px;
|
13 |
-
background-color: #f4f4f4;
|
14 |
-
border-radius: 10px;
|
15 |
-
}
|
16 |
-
|
17 |
-
h1 {
|
18 |
-
text-align: center;
|
19 |
-
color: #333;
|
20 |
-
}
|
21 |
-
|
22 |
-
form {
|
23 |
-
background-color: #fff;
|
24 |
-
padding: 20px;
|
25 |
-
border-radius: 8px;
|
26 |
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
27 |
-
}
|
28 |
-
|
29 |
-
label, select, button, input {
|
30 |
-
display: block;
|
31 |
-
margin-bottom: 15px;
|
32 |
-
}
|
33 |
-
|
34 |
-
select, input {
|
35 |
-
width: 100%;
|
36 |
-
padding: 10px;
|
37 |
-
border: 1px solid #ccc;
|
38 |
-
border-radius: 4px;
|
39 |
-
}
|
40 |
-
|
41 |
-
input[type="checkbox"] {
|
42 |
-
margin-right: 5px;
|
43 |
-
}
|
44 |
-
|
45 |
-
button {
|
46 |
-
background-color: #4caf50;
|
47 |
-
color: #fff;
|
48 |
-
padding: 10px;
|
49 |
-
border: none;
|
50 |
-
border-radius: 4px;
|
51 |
-
cursor: pointer;
|
52 |
-
transition: background-color 0.3s ease;
|
53 |
-
}
|
54 |
-
|
55 |
-
button:hover {
|
56 |
-
background-color: #45a049;
|
57 |
-
}
|
58 |
-
|
59 |
-
a {
|
60 |
-
color: #2196F3;
|
61 |
-
text-decoration: none;
|
62 |
-
display: block;
|
63 |
-
margin-top: 10px;
|
64 |
-
}
|
65 |
-
|
66 |
-
a:hover {
|
67 |
-
text-decoration: underline;
|
68 |
-
}
|
69 |
</style>
|
70 |
</head>
|
71 |
<body>
|
@@ -144,6 +84,14 @@
|
|
144 |
// Display detected format
|
145 |
formatDisplay.textContent = file.type;
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
// Convert and create a download link
|
148 |
const img = new Image();
|
149 |
img.src = URL.createObjectURL(file);
|
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Image Format Converter</title>
|
7 |
<style>
|
8 |
+
/* Your existing styles... */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
</style>
|
10 |
</head>
|
11 |
<body>
|
|
|
84 |
// Display detected format
|
85 |
formatDisplay.textContent = file.type;
|
86 |
|
87 |
+
// Check if the target format is supported
|
88 |
+
const supportedFormats = ['image/bmp', 'image/eps', 'image/gif', 'image/ico', 'image/jpeg', 'image/png', 'image/psd', 'image/svg+xml', 'image/tga', 'image/tiff', 'image/webp'];
|
89 |
+
|
90 |
+
if (!supportedFormats.includes(targetFormat)) {
|
91 |
+
alert('Unsupported target format. Please choose a supported format.');
|
92 |
+
return;
|
93 |
+
}
|
94 |
+
|
95 |
// Convert and create a download link
|
96 |
const img = new Image();
|
97 |
img.src = URL.createObjectURL(file);
|