From bf92d4f98104cf8581b6fe02f67e1730153186ee Mon Sep 17 00:00:00 2001 From: ld3zian <42660576+ld3z@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:36:17 -0700 Subject: [PATCH] i do not like avif --- src/components/ComicCard.astro | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/components/ComicCard.astro b/src/components/ComicCard.astro index 03ba864..28a0ff0 100644 --- a/src/components/ComicCard.astro +++ b/src/components/ComicCard.astro @@ -1,4 +1,5 @@ --- +// Import the necessary types and assets import type { Comic } from '../lib/types'; import { Image } from 'astro:assets'; @@ -7,14 +8,29 @@ interface Props { } const { comic } = Astro.props; -const coverUrl = comic.md_comics.md_covers[0] + +// Determine if the file is AVIF based on the URL +const isAvif = comic.md_comics.md_covers[0]?.b2key.endsWith('.avif'); + +const coverUrl = comic.md_comics.md_covers[0] ? `https://meo.comick.pictures/${comic.md_comics.md_covers[0].b2key}` : '/placeholder.png'; --- -
- {comic.md_comics.title} + {!isAvif ? ( + // Infer size only for non-AVIF files + {comic.md_comics.title} + ) : ( + // Provide fallback handling for AVIF files + {comic.md_comics.title} + )}

{comic.md_comics.title}

Chapter {comic.chap}

@@ -66,4 +82,4 @@ const coverUrl = comic.md_comics.md_covers[0] margin-top: 0.5rem; font-size: 0.8rem !important; } - \ No newline at end of file +