[WEB] Load thumbnail with native source property for faster load time (#378)

This commit is contained in:
Alex 2022-07-26 15:13:08 -05:00 committed by GitHub
parent e4c4b53fcd
commit 2336a6159c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 19 deletions

View File

@ -44,6 +44,10 @@ body {
color: #5f6368;
}
input:focus-visible {
outline-offset: 0px !important;
outline: none !important;
}
@layer utilities {
.immich-form-input {
@apply bg-slate-100 p-2 rounded-md focus:border-immich-primary text-sm;

View File

@ -246,25 +246,15 @@
<!-- Thumbnail -->
{#if intersecting}
{#await loadImageData()}
<div
style:width={`${thumbnailSize}px`}
style:height={`${thumbnailSize}px`}
class={`bg-immich-primary/10 ${getSize()} flex place-items-center place-content-center `}
>
...
</div>
{:then imageData}
<img
style:width={`${thumbnailSize}px`}
style:height={`${thumbnailSize}px`}
in:fade={{ duration: 250 }}
src={imageData}
alt={asset.id}
class={`object-cover ${getSize()} transition-all duration-100 z-0 ${getThumbnailBorderStyle()}`}
loading="lazy"
/>
{/await}
<img
style:width={`${thumbnailSize}px`}
style:height={`${thumbnailSize}px`}
in:fade={{ duration: 250 }}
src={`/api/asset/thumbnail/${asset.id}?format=${format}`}
alt={asset.id}
class={`object-cover ${getSize()} transition-all duration-100 z-0 ${getThumbnailBorderStyle()}`}
loading="lazy"
/>
{/if}
{#if mouseOver && asset.type === AssetTypeEnum.Video}