mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-11-14 00:43:50 +00:00
handle loading image from url
This commit is contained in:
parent
664c58e863
commit
60fd19cb17
@ -13,7 +13,18 @@
|
||||
|
||||
async function loadImage(url: string): Promise<ImageData> {}
|
||||
|
||||
function uploadImage(event: Event) {}
|
||||
function uploadImage(event: Event) {
|
||||
// Revoke previous image url, if any
|
||||
if (imageURL) URL.revokeObjectURL(imageURL);
|
||||
|
||||
// Get user input
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input?.files?.[0];
|
||||
if (!file) return;
|
||||
|
||||
// Load image data from file
|
||||
imageURL = URL.createObjectURL(file);
|
||||
}
|
||||
</script>
|
||||
|
||||
<input type="file" name="image" accept="image/*" on:change={uploadImage} />
|
||||
|
Loading…
Reference in New Issue
Block a user