impr: optimize image delivery

This commit is contained in:
James Xylight committed 2025-07-14 18:35:44 -07:00
1 parent 5c9c909787
commit b08df2a966
5 files changed
+82 -50

No files matched your search

@@ -30,11 +30,11 @@
{#if embed_title && view == 'cozy'}
<a target="_blank" href={url} class="group/link">
<Material
color="distinct"
class="flex flex-col-reverse sm:flex-row
overflow-hidden gap-4 embed-card z-0 relative
dark:border-t-zinc-800 border-opacity-80 max-w-full
dark:bg-zinc-950 group-hover/link:bg-slate-50 dark:group-hover/link:bg-zinc-900 transition-colors"
color="uniform"
class={[
'flex flex-col-reverse sm:flex-row overflow-hidden gap-4 embed-card z-0 relative',
'dark:bg-zinc-950 group-hover/link:bg-slate-50 dark:group-hover/link:bg-zinc-900 transition-colors',
]}
rounding="2xl"
element="article"
>
@@ -60,24 +60,27 @@
<picture
class="-m-4 mb-auto sm:-mb-4 sm:ml-auto shrink-0 sm:w-1/3 sm:max-w-60"
>
<source
srcset={optimizeImageURL(thumbnail_url, 256)}
media="(max-width: 256px)"
/>
<source
srcset={optimizeImageURL(thumbnail_url, 512)}
media="(max-width: 512px)"
/>
<source
srcset={optimizeImageURL(thumbnail_url, 1024)}
media="(max-width: 1024px)"
/>
{#each ['webp'] as format}
<source
srcset="{optimizeImageURL(
thumbnail_url,
256,
format as 'avif' | 'webp',
)} 256w, {optimizeImageURL(
thumbnail_url,
512,
format as 'avif' | 'webp',
)} 512w"
media="(min-width: 0px)"
type="image/{format}"
/>
{/each}
<img
src={optimizeImageURL(thumbnail_url, -1)}
class="object-cover w-full sm:max-w-96 h-32 sm:min-h-16 bg-slate-200 dark:bg-zinc-800"
width={600}
height={400}
alt=" "
alt=""
class:blur-3xl={nsfw}
/>
</picture>