Spaces:
Running
Running
Update index.html
Browse files- index.html +94 -16
index.html
CHANGED
@@ -1,19 +1,97 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
+
<head>
|
4 |
+
<title>Photo Comparison</title>
|
5 |
+
<style>
|
6 |
+
body {
|
7 |
+
font-family: Arial, sans-serif;
|
8 |
+
margin: 0;
|
9 |
+
padding: 0;
|
10 |
+
background-color: #f8f8f8;
|
11 |
+
}
|
12 |
+
h1 {
|
13 |
+
text-align: center;
|
14 |
+
color: #333;
|
15 |
+
margin-top: 20px;
|
16 |
+
}
|
17 |
+
form {
|
18 |
+
text-align: center;
|
19 |
+
margin-top: 50px;
|
20 |
+
}
|
21 |
+
input[type="file"] {
|
22 |
+
display: block;
|
23 |
+
margin: 0 auto;
|
24 |
+
}
|
25 |
+
button[type="button"] {
|
26 |
+
display: block;
|
27 |
+
margin: 0 auto;
|
28 |
+
padding: 10px 20px;
|
29 |
+
background-color: #333;
|
30 |
+
color: #fff;
|
31 |
+
border: none;
|
32 |
+
border-radius: 4px;
|
33 |
+
font-size: 16px;
|
34 |
+
cursor: pointer;
|
35 |
+
}
|
36 |
+
button[type="button"]:hover {
|
37 |
+
background-color: #444;
|
38 |
+
}
|
39 |
+
div {
|
40 |
+
text-align: center;
|
41 |
+
margin-top: 50px;
|
42 |
+
}
|
43 |
+
img {
|
44 |
+
max-width: 100%;
|
45 |
+
height: auto;
|
46 |
+
border: 1px solid #ccc;
|
47 |
+
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
|
48 |
+
margin: 10px;
|
49 |
+
}
|
50 |
+
p {
|
51 |
+
text-align: center;
|
52 |
+
font-size: 20px;
|
53 |
+
color: #333;
|
54 |
+
margin-top: 50px;
|
55 |
+
}
|
56 |
+
</style>
|
57 |
+
</head>
|
58 |
+
<body>
|
59 |
+
<h1>Choose the Best Photo</h1>
|
60 |
+
<form>
|
61 |
+
<input type="file" id="photo1Input" accept="image/*">
|
62 |
+
<input type="file" id="photo2Input" accept="image/*">
|
63 |
+
<br><br>
|
64 |
+
<button type="button" onclick="choosePhoto()">Choose Best Photo</button>
|
65 |
+
</form>
|
66 |
+
<div>
|
67 |
+
<img src="" alt="Photo 1" id="photo1">
|
68 |
+
<img src="" alt="Photo 2" id="photo2">
|
69 |
+
</div>
|
70 |
+
<p id="result"></p>
|
71 |
+
<script>
|
72 |
+
function choosePhoto() {
|
73 |
+
var photo1 = document.getElementById("photo1");
|
74 |
+
var photo2 = document.getElementById("photo2");
|
75 |
+
var photo1Input = document.getElementById("photo1Input");
|
76 |
+
var photo2Input = document.getElementById("photo2Input");
|
77 |
+
|
78 |
+
// Set image sources to uploaded files
|
79 |
+
photo1.src = URL.createObjectURL(photo1Input.files[0]);
|
80 |
+
photo2.src = URL.createObjectURL(photo2Input.files[0]);
|
81 |
+
|
82 |
+
// Determine which photo is larger
|
83 |
+
var size1 = photo1.naturalWidth * photo1.naturalHeight;
|
84 |
+
var size2 = photo2.naturalWidth * photo2.naturalHeight;
|
85 |
+
|
86 |
+
// Display result
|
87 |
+
if (size1 > size2) {
|
88 |
+
document.getElementById("result").innerHTML = "The best photo is Photo 1.";
|
89 |
+
} else if (size2 > size1) {
|
90 |
+
document.getElementById("result").innerHTML = "The best photo is Photo 2.";
|
91 |
+
} else {
|
92 |
+
document.getElementById("result").innerHTML = "Both photos are equally good.";
|
93 |
+
}
|
94 |
+
}
|
95 |
+
</script>
|
96 |
+
</body>
|
97 |
</html>
|