-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
96 lines (92 loc) · 2.19 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<style>
body {
text-align: center;
height: 100vh;
width: 100vw;
margin: 0;
background: linear-gradient(to bottom right, #352482, #ea8f78);
}
#form {
zoom: 1.5;
height: 80px;
width: 20vw;
margin: 0 23.5vw;
text-align: left;
}
.right {
float: right;
}
#password {
max-width: 200px;
float: left;
}
@media screen and (max-width: 1300px) {
#form {
zoom: 1.5;
width: calc((100vw - 20px) / 1.5 - 8px);
margin: 10px;
}
}
</style>
</head>
<body>
<form
method="POST"
action="/upload"
enctype="multipart/form-data"
accept="image/*"
id="form"
>
<input
type="file"
name="file"
id="input-file"
accept="image/jpeg,image/png,image/heif,image/heic,image/webp"
/>
<div class="right">
<input
type="password"
name="password"
id="password"
placeholder="Password"
/>
<br />
<input type="submit" value="Submit" class="right" />
</div>
</form>
<br />
<img src="" id="image-preview" width="100vw" />
<script
src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous"
></script>
<script type="text/javascript">
function readImage(input) {
let file = input.files && input.files[0]
if (file) {
let reader = new FileReader()
reader.onload = e => {
$('#image-preview')
.attr('src', e.target.result)
.css('min-width', '600px')
.css('max-height', '100vh')
.css('max-width', '100vw')
}
reader.readAsDataURL(file)
}
}
$('#input-file').change(function () {
readImage(this)
})
</script>
</body>
</html>