mirror of
https://github.com/immich-app/immich.git
synced 2025-06-01 04:36:19 -04:00
* feat: hide faces * fix: types * pr feedback * fix: svelte checks * feat: new server endpoint * refactor: rename person count dto * fix(server): linter * fix: remove duplicate button * docs: add comments * pr feedback * fix: get unhidden faces * fix: do not use PersonCountResponseDto * fix: transition * pr feedback * pr feedback * fix: remove unused check * add server tests * rename persons to people * feat: add exit button * pr feedback * add server tests * pr feedback * pr feedback * fix: show & hide faces * simplify * fix: close button * pr feeback * pr feeback --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
55 lines
1.5 KiB
Svelte
55 lines
1.5 KiB
Svelte
<script lang="ts">
|
|
import { imageLoad } from '$lib/utils/image-load';
|
|
import { fade } from 'svelte/transition';
|
|
import { thumbHashToDataURL } from 'thumbhash';
|
|
import { Buffer } from 'buffer';
|
|
import EyeOffOutline from 'svelte-material-icons/EyeOffOutline.svelte';
|
|
|
|
export let url: string;
|
|
export let altText: string;
|
|
export let heightStyle: string | undefined = undefined;
|
|
export let widthStyle: string;
|
|
export let thumbhash: string | null = null;
|
|
export let curve = false;
|
|
export let shadow = false;
|
|
export let circle = false;
|
|
export let hidden = false;
|
|
let complete = false;
|
|
</script>
|
|
|
|
<img
|
|
style:width={widthStyle}
|
|
style:height={heightStyle}
|
|
style:filter={hidden ? 'grayscale(75%)' : 'none'}
|
|
src={url}
|
|
alt={altText}
|
|
class="object-cover transition duration-300"
|
|
class:rounded-lg={curve}
|
|
class:shadow-lg={shadow}
|
|
class:rounded-full={circle}
|
|
class:opacity-0={!thumbhash && !complete}
|
|
draggable="false"
|
|
use:imageLoad
|
|
on:image-load|once={() => (complete = true)}
|
|
/>
|
|
{#if hidden}
|
|
<div class="absolute top-1/2 left-1/2 transform translate-x-[-50%] translate-y-[-50%]">
|
|
<EyeOffOutline size="2em" />
|
|
</div>
|
|
{/if}
|
|
|
|
{#if thumbhash && !complete}
|
|
<img
|
|
style:width={widthStyle}
|
|
style:height={heightStyle}
|
|
src={thumbHashToDataURL(Buffer.from(thumbhash, 'base64'))}
|
|
alt={altText}
|
|
class="absolute object-cover top-0"
|
|
class:rounded-lg={curve}
|
|
class:shadow-lg={shadow}
|
|
class:rounded-full={circle}
|
|
draggable="false"
|
|
out:fade={{ duration: 300 }}
|
|
/>
|
|
{/if}
|