-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
83 lines (72 loc) · 2.03 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
<!DOCTYPE html>
<html>
<head>
<title>bolik</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter&display=swap" rel="stylesheet">
<style>
body {
background-color: #fff1f4;
}
* {
font-family: 'Inter', sans-serif;
color: #913b69;
}
main {
display: flex;
align-items: center;
gap: 2rem;
flex-direction: column;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
form {
width: 20rem;
margin-top: 1rem;
display: flex;
gap: 1rem;
flex-direction: column;
}
img {
margin: 0 auto;
max-width: 100%;
}
</style>
</head>
<body>
<main>
<div>
<h1>bolik</h1>
<a href="https://github.com/fogo-sh/bolik">
github.com/fogo-sh/bolik
</a>
</div>
<form id="form">
<input type="file" name="image" />
<textarea name="args">[{"liquid-rescale": "50%x50%"}]</textarea>
<button>submit</button>
</form>
<img id="output" />
</main>
<script type="module">
form.addEventListener('submit', (event) => {
event.preventDefault();
const formData = new FormData(event.target);
fetch('/', {
method: 'post',
body: formData,
}).then(async (response) => {
const imageBlob = await response.blob()
const reader = new FileReader();
reader.readAsDataURL(imageBlob);
reader.onloadend = () => {
const base64data = reader.result;
output.src = base64data;
}
});
});
</script>
</body>
</html>