mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
* add thumbhash: server generation and web impl * move logic to infra & use byta in db * remove unnecesary logs * update generated API and simplify thumbhash gen * fix check errors * removed unnecessary library and css tag * style edits * syntax mistake * update server test, change thumbhash job name * fix tests * Update server/src/domain/asset/response-dto/asset-response.dto.ts Co-authored-by: Thomas <9749173+uhthomas@users.noreply.github.com> * add unit test, change migration date * change to official thumbhash impl * update call method to not use eval * "generate missing" looks for thumbhash * improve queue & improve syntax * update syntax again * update tests * fix thumbhash generation * consolidate queueing to avoid duplication * cover all types of incorrect thumbnail cases * split out jest tasks * put back thumbnail duration loading for images without thumbhash * Remove stray package.json --------- Co-authored-by: Luke McCarthy <mail@lukehmcc.com> Co-authored-by: Thomas <9749173+uhthomas@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
59 lines
1.3 KiB
Svelte
59 lines
1.3 KiB
Svelte
<script lang="ts">
|
|
import { onMount } from 'svelte';
|
|
import { lazyLoad } from 'unlazy';
|
|
import { imageLoad } from '$lib/utils/image-load';
|
|
|
|
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;
|
|
let loading = true;
|
|
|
|
let imageElement: HTMLImageElement;
|
|
|
|
onMount(() => {
|
|
if (thumbhash) {
|
|
lazyLoad(imageElement, {
|
|
hash: thumbhash,
|
|
hashType: 'thumbhash'
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
|
|
{#if thumbhash}
|
|
<img
|
|
style:width={widthStyle}
|
|
style:height={heightStyle}
|
|
data-src={url}
|
|
alt={altText}
|
|
class="object-cover"
|
|
class:rounded-lg={curve}
|
|
class:shadow-lg={shadow}
|
|
class:rounded-full={circle}
|
|
draggable="false"
|
|
bind:this={imageElement}
|
|
/>
|
|
|
|
<!-- not everthing yet has thumbhash support so the old method is kept -->
|
|
{:else}
|
|
<img
|
|
style:width={widthStyle}
|
|
style:height={heightStyle}
|
|
src={url}
|
|
alt={altText}
|
|
class="object-cover transition-opacity duration-300"
|
|
class:rounded-lg={curve}
|
|
class:shadow-lg={shadow}
|
|
class:rounded-full={circle}
|
|
class:opacity-0={loading}
|
|
draggable="false"
|
|
use:imageLoad
|
|
on:image-load|once={() => (loading = false)}
|
|
/>
|
|
{/if}
|