इसे छोड़कर कंटेंट पर जाएं
This is an unmaintained snapshot of the Astro v4 docs. View the latest docs.

Local images must be imported.

यह कंटेंट अभी तक आपकी भाषा में उपलब्ध नहीं है।

LocalImageUsedWrongly: Image’s and getImage’s src parameter must be an imported image or an URL, it cannot be a string filepath. Received IMAGE_FILE_PATH.

When using the default image services, Image’s and getImage’s src parameter must be either an imported image or an URL, it cannot be a string of a filepath.

For local images from content collections, you can use the image() schema helper to resolve the images.

---
import { Image } from "astro:assets";
import myImage from "../my_image.png";
---
<!-- GOOD: `src` is the full imported image. -->
<Image src={myImage} alt="Cool image" />
<!-- GOOD: `src` is a URL. -->
<Image src="https://example.com/my_image.png" alt="Cool image" />
<!-- BAD: `src` is an image's `src` path instead of the full image object. -->
<Image src={myImage.src} alt="Cool image" />
<!-- BAD: `src` is a string filepath. -->
<Image src="../my_image.png" alt="Cool image" />

See Also:

योगदान करें

आपके दिमाग में क्या है?

समुदाय