mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-26 03:51:45 +00:00
send data url to server
This commit is contained in:
parent
ad72d2582e
commit
8f4e669d51
@ -10,6 +10,12 @@
|
||||
let imageURL: string | null, lastImage: File;
|
||||
let uploadData: UploadData;
|
||||
|
||||
async function sendImage(url: string) {
|
||||
const fdata = new FormData();
|
||||
fdata.append('url', url);
|
||||
await post(fdata, 'upload');
|
||||
}
|
||||
|
||||
async function fileAsDataURL(file: File, width: number, height: number): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const img = new Image();
|
||||
@ -73,8 +79,13 @@
|
||||
{#await fileAsDataURL(lastImage, 192, 192)}
|
||||
<p>Loading image data . . .</p>
|
||||
<p>{uploadData.elapsed} seconds elapsed.</p>
|
||||
{:then}
|
||||
<p>Done!</p>
|
||||
<p>{uploadData.elapsed} seconds elapsed.</p>
|
||||
{:then dataUrl}
|
||||
{#await sendImage(dataUrl)}
|
||||
<p>Sending image . . .</p>
|
||||
<p>{uploadData.elapsed} seconds elapsed.</p>
|
||||
{:then}
|
||||
<p>Done!</p>
|
||||
<p>{uploadData.elapsed} seconds elapsed.</p>
|
||||
{/await}
|
||||
{/await}
|
||||
{/if}
|
||||
|
Loading…
Reference in New Issue
Block a user