25 lines
519 B
Svelte
25 lines
519 B
Svelte
<script lang="ts">
|
|
import { store as imageStore } from "../stores/images";
|
|
|
|
let images = [];
|
|
const urlCreator = window.URL || window.webkitURL;
|
|
|
|
$: if ($imageStore.length) {
|
|
images = $imageStore.map((img) => {
|
|
const blob = new Blob([img.data], { type: img.type });
|
|
const imageUrl = urlCreator.createObjectURL(blob);
|
|
return {
|
|
...img,
|
|
imageUrl,
|
|
};
|
|
});
|
|
}
|
|
</script>
|
|
|
|
{#each images as img}
|
|
<p>{img.filename}</p>
|
|
<img src={img.imageUrl} />
|
|
{/each}
|
|
|
|
<h3>List</h3>
|