--- import path from "path"; interface Props { id?: string src: string; class?: string; alt?: string basePath?: string } import { Image } from 'astro:assets'; const {id, src, alt, basePath = '/'} = Astro.props; const className = Astro.props.class; const isLocal = !(src.startsWith('/') || src.startsWith('http') || src.startsWith('https') || src.startsWith('data:')); // TODO temporary workaround for images dynamic import // https://github.com/withastro/astro/issues/3373 let img; if (isLocal) { const files = import.meta.glob("../../**", { import: 'default' }); let normalizedPath = path.normalize(path.join("../../", basePath, src)).replace(/\\/g, "/"); img = await (files[normalizedPath])(); } ---
{isLocal && {alt} {!isLocal && {alt}