-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
206 lines (194 loc) · 4.76 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:600&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Poppins&display=swap" rel="stylesheet">
<style>
body {
margin: 0;
font-family: 'Open Sans', sans-serif;
background-color: #f8fafb;
}
.Header {
text-align: center;
box-shadow: 0px 1px 10px #cccccc;
color: #222;
font-weight: bolder;
font-size: 22px;
padding: 10px 0;
width: 100%;
margin: 0;
}
.fileuploaderWrapper {
padding: 15px 0;
width: 250px;
margin: 40px auto 0 auto;
background-color: #d4d4d4;
border-radius: 5px;
box-shadow: 3px 3px 4px #aaa;
}
.fileuploader {
width: 60px;
height: 60px;
display: flex;
margin: 5px auto 0px auto;
}
input[type="file"] {
display: none;
}
.icon {
font-size: 60px;
color: #3032b6;
height: auto;
}
.upload_tag_line {
text-align: center;
margin: 0;
font-size: 18px;
font-family: 'Poppins', sans-serif;
}
.submitbtn {
background: #3032b6;
color: white;
padding: 10px;
font-weight: 600;
font-size: 15px;
border-radius: 5px;
width: 100%;
position: fixed;
bottom: 1px;
box-shadow: 0px 1px 10px #cccccc;
}
@media screen and (min-width: 600px) {
.submitbtn {
position: static;
width: 120px;
padding: 10px 35px;
margin: 50px auto;
display: flex;
}
}
.uploaded_img {
width: 80%;
max-width: 400px;
display: flex;
margin: 5vh auto 0 auto;
border-radius: 5px;
box-shadow: 10px 10px 10px #cccccc;
}
/**
* loader
*/
.lds-ring-container {
display: none;
width: 64px;
margin: auto;
margin-top: 20px;
}
.lds-ring {
display: inline-block;
position: relative;
width: 64px;
height: 64px;
}
.lds-ring div {
box-sizing: border-box;
display: block;
position: absolute;
width: 51px;
height: 51px;
margin: 6px;
border: 6px solid #3032b6;
border-radius: 50%;
animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
border-color: #3032b6 transparent transparent transparent;
}
.lds-ring div:nth-child(1) {
animation-delay: -0.45s;
}
.lds-ring div:nth-child(2) {
animation-delay: -0.3s;
}
.lds-ring div:nth-child(3) {
animation-delay: -0.15s;
}
@keyframes lds-ring {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
<script>
let dataURL
let img_data
function b64toBlob(dataURI) {
var byteString = atob(dataURI.split(',')[1]);
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ab], { type: 'image/dng' });
}
function read_file(file) {
var input = file.target
var reader = new FileReader()
reader.onload = function(){
dataURL = reader.result
// let uploaded_img = document.getElementById('uploaded_img')
// uploaded_img.src = dataURL
console.log(dataURL)
}
img_data = reader.readAsDataURL(input.files[0])
}
// function upload_img() {
// const formData = new FormData()
// var blob = b64toBlob(dataURL)
// formData.append('uploaded_img', blob)
// fetch('http://localhost:5000/upload', {
// method: 'POST',
// headers: {
// "Content-Type": 'multipart/form-data'
// },
// body: formData
// })
// .then(res => console.log(res))
// .catch(err => console.error(err))
// }
function show_loader() {
let loader = document.getElementById("loader")
loader.style.display = "block"
}
</script>
<title>Nictovision</title>
</head>
<body>
<h2 class="Header"> Nictovision </h2>
<form method="POST" enctype=multipart/form-data>
<div class="fileuploaderWrapper">
<label for="upload_img" class="fileuploader">
<!-- <img src="./icons/upload-solid.svg" alt="" class="icon"> -->
<i class="fas fa-upload icon"></i>
<input type="file" name="upload_img" id="upload_img" onchange="read_file(event)">
</label>
<p class="upload_tag_line">Upload Your Files</p>
</div>
<div id="loader" class="lds-ring-container">
<div class="lds-ring"><div></div><div></div><div></div><div></div></div>
</div>
<p id="p-input"></p>
<img id="input-image" src="original/input.png" alt="" class="uploaded_img">
<p id="p-output"></p>
<img src="result/ios.png" alt="" style="margin-bottom: 30px;" class="uploaded_img">
<div>
<input type="submit" class="submitbtn" value="Submit" onclick="show_loader()">
</div>
</form>
</body>
</html>