Hi, Im trying to create a movie app to learn astro. I am using TMDB API in order to get the data. So the images are hosted remotelly in tmdb. I try to add Image component to the web but it threw an error:
Image's and getImage's src parameter must be an imported image or an URL, it cannot be a string filepath. Received src.
Here below is the code
---
import { Image } from 'astro:assets';
const { original_title, poster_path } = Astro.props;
interface Props {
original_title: string;
poster_path: string;
}
---
<h2>{original_title}</h2>
<Image
src=`https://image.tmdb.org/t/p/original${poster_path}`
alt="descriptive text"
width="190"
height="270" />
I saw this article in the astro documentation: https://docs.astro.build/en/recipes/dynamically-importing-images/ but it seems to be only useful with local images and not with URLs. I changed the Image component to a img tag and it worker. So my questions is, there's a way to optimize the remote imported images with Image? Or it's just and limitation and we have to load them with img tag.
Thank you