diff --git a/components/RecipeCard.tsx b/components/RecipeCard.tsx index be918fc..2d4a491 100644 --- a/components/RecipeCard.tsx +++ b/components/RecipeCard.tsx @@ -1,10 +1,11 @@ import { Card } from "@components/Card.tsx"; import { Recipe } from "@lib/resource/recipes.ts"; +import { isLocalImage } from "@lib/string.ts"; export function RecipeCard({ recipe }: { recipe: Recipe }) { const { meta: { image = "/placeholder.svg" } = {} } = recipe; - const imageUrl = image.startsWith("Recipes/images/") + const imageUrl = isLocalImage(image) ? `/api/images?image=${image}&width=200&height=200` : image; diff --git a/components/RecipeHero.tsx b/components/RecipeHero.tsx index 18cde2b..d46967b 100644 --- a/components/RecipeHero.tsx +++ b/components/RecipeHero.tsx @@ -4,6 +4,7 @@ import { IconEdit, IconExternalLink, } from "@components/icons.tsx"; +import { isLocalImage } from "@lib/string.ts"; export function RecipeHero( { data, subline, backlink, editLink }: { @@ -15,10 +16,9 @@ export function RecipeHero( ) { const { meta: { image } = {} } = data; - const imageUrl = - (image?.startsWith("Recipes/images/") || image?.startsWith("Media/movies/")) - ? `/api/images?image=${image}&width=800` - : image; + const imageUrl = (image && isLocalImage(image)) + ? `/api/images?image=${image}&width=800` + : image; return (
{