35 lines
985 B
Markdown
35 lines
985 B
Markdown
# fishbowl
|
|
<hr/>
|
|
|
|
Choose an image and click submit. The image will be sent and processed by my
|
|
server, so be mindful of what you submit. No logs or copies of the input are
|
|
preserved.
|
|
<form id="fishForm">
|
|
<label for="fishFile"> Select an image: </label>
|
|
<br/>
|
|
<input id="fishFile" accept="image/*" type="file"/>
|
|
<br/>
|
|
<input value="Run Fishbowl" type="submit"/>
|
|
</form>
|
|
<img id="fishImage" width="480" height="480"/>
|
|
<script>
|
|
const form = document.getElementById("fishForm");
|
|
const image = document.getElementById("fishImage");
|
|
form.onsubmit = async (ev) => {
|
|
ev.preventDefault();
|
|
image.src = "";
|
|
try {
|
|
const file = document.getElementById("fishFile").files[0];
|
|
const arrayBuf = await file.arrayBuffer();
|
|
const response = await fetch("/api/fishbowl", {
|
|
method: 'POST',
|
|
body: arrayBuf,
|
|
});
|
|
const blob = await response.blob();
|
|
image.src = URL.createObjectURL(blob);
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
}
|
|
</script>
|