initialize image page

This commit is contained in:
waltem01 2024-02-15 08:06:31 +01:00
parent cd31c576ec
commit d75b74965b

View File

@ -0,0 +1,28 @@
<script lang="ts">
import type { APIResponse } from '$lib/interfaces';
interface UploadData {
start: number;
elapsed: string;
interval: NodeJS.Timeout;
}
let imageURL: string, uploadData: UploadData;
async function loadImage(url: string) {}
function uploadImage(event: Event) {}
</script>
<input type="file" name="image" accept="image/*" on:change={uploadImage} />
{#if imageURL}
<img src={imageURL} alt="User uploaded" />
{#await loadImage(imageURL)}
<p>Loading image . . .</p>
<p>{uploadData.elapsed} seconds elapsed.</p>
{:then imageData}
<p>Done!</p>
<p>{uploadData.elapsed} seconds elapsed.</p>
{clearInterval(uploadData.interval)}
{/await}
{/if}