feat(image): enhance image handling with new properties and responsive support
- Updated PostEntry type to include _rawImageUrl and _imageFocal for improved image management. - Refactored image handling in various components to utilize the new properties, ensuring better focal point support and responsive image rendering. - Introduced warmResponsiveImage function for pre-fetching image variants to optimize loading performance. - Replaced CmsImage component with RustyImage in multiple blocks for consistent image processing.
This commit is contained in:
@@ -107,6 +107,8 @@ export const load: PageServerLoad = async ({ params, locals, url }) => {
|
||||
return {
|
||||
post,
|
||||
postImageUrl,
|
||||
rawPostImageUrl: postImageField?.url ?? null,
|
||||
postImageFocal: postImageField?.focal ?? null,
|
||||
postDate,
|
||||
contentHtml,
|
||||
hasRowContent,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import EventBadges from '$lib/components/EventBadges.svelte';
|
||||
import EventMap from '$lib/components/EventMap.svelte';
|
||||
import Accordion from '$lib/components/Accordion.svelte';
|
||||
import RustyImage from '$lib/components/RustyImage.svelte';
|
||||
import { t, T } from '$lib/translations';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
@@ -32,7 +33,21 @@
|
||||
{/if}
|
||||
|
||||
<div class="md:flex gap-2 items-end">
|
||||
{#if data.postImageUrl}
|
||||
{#if data.rawPostImageUrl}
|
||||
<div class="overflow-hidden inline-block my-4 border border-white self-start ring-1 ring-black/50 shadow-lg">
|
||||
<RustyImage
|
||||
src={data.rawPostImageUrl}
|
||||
focal={data.postImageFocal}
|
||||
width={150}
|
||||
height={200}
|
||||
fit="cover"
|
||||
alt=""
|
||||
class="block object-cover"
|
||||
loading="eager"
|
||||
fetchpriority="high"
|
||||
/>
|
||||
</div>
|
||||
{:else if data.postImageUrl}
|
||||
<div class="overflow-hidden inline-block my-4 border border-white self-start ring-1 ring-black/50 shadow-lg">
|
||||
<img
|
||||
src={data.postImageUrl}
|
||||
|
||||
Reference in New Issue
Block a user