Update index.html
Browse files- index.html +12 -48
index.html
CHANGED
@@ -5,53 +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 {
|
30 |
-
display: block;
|
31 |
-
margin: 10px 0;
|
32 |
-
}
|
33 |
-
|
34 |
-
button {
|
35 |
-
background-color: #4caf50;
|
36 |
-
color: #fff;
|
37 |
-
padding: 10px;
|
38 |
-
border: none;
|
39 |
-
border-radius: 4px;
|
40 |
-
cursor: pointer;
|
41 |
-
}
|
42 |
-
|
43 |
-
button:hover {
|
44 |
-
background-color: #45a049;
|
45 |
-
}
|
46 |
-
|
47 |
-
a {
|
48 |
-
color: #2196F3;
|
49 |
-
text-decoration: none;
|
50 |
-
}
|
51 |
-
|
52 |
-
a:hover {
|
53 |
-
text-decoration: underline;
|
54 |
-
}
|
55 |
</style>
|
56 |
</head>
|
57 |
<body>
|
@@ -59,7 +13,7 @@
|
|
59 |
|
60 |
<form id="imageForm">
|
61 |
<label for="imageInput">Select an Image:</label>
|
62 |
-
<input type="file" id="imageInput" accept="image/*" required>
|
63 |
|
64 |
<p id="formatInfo">Detected Format: <span id="formatDisplay"></span></p>
|
65 |
|
@@ -85,6 +39,16 @@
|
|
85 |
</form>
|
86 |
|
87 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
function convertImage() {
|
89 |
const input = document.getElementById('imageInput');
|
90 |
const targetFormat = document.getElementById('targetFormat').value;
|
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Image Format Converter</title>
|
7 |
<style>
|
8 |
+
/* ... (unchanged styles) */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
</style>
|
10 |
</head>
|
11 |
<body>
|
|
|
13 |
|
14 |
<form id="imageForm">
|
15 |
<label for="imageInput">Select an Image:</label>
|
16 |
+
<input type="file" id="imageInput" accept="image/*" required onchange="detectImageFormat()">
|
17 |
|
18 |
<p id="formatInfo">Detected Format: <span id="formatDisplay"></span></p>
|
19 |
|
|
|
39 |
</form>
|
40 |
|
41 |
<script>
|
42 |
+
function detectImageFormat() {
|
43 |
+
const input = document.getElementById('imageInput');
|
44 |
+
const formatDisplay = document.getElementById('formatDisplay');
|
45 |
+
|
46 |
+
if (input.files.length > 0) {
|
47 |
+
const file = input.files[0];
|
48 |
+
formatDisplay.textContent = file.type;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
function convertImage() {
|
53 |
const input = document.getElementById('imageInput');
|
54 |
const targetFormat = document.getElementById('targetFormat').value;
|