Image processing not working
Closed this issue · 4 comments
Astro Info
Astro v5.0.3
Node v18.20.3
System Linux (x64)
Package Manager pnpm
Output static
Adapter none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
The link for generated by Astro image is incorrect. When image parsing astro add's this thing called _ASTRO_IMAGE_
.
When the content is then used the relative path that is written is removed and nothing else happens.
What's the expected result?
I expected the image schema creator to resolve images created by astro to create the right path.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-ftgpwvjn?file=src%2Fcontent.config.ts
Participation
- I am willing to submit a pull request for this issue.
That prefix is used internally to track image imports. You're trying to read them at the wrong time. If you check the data in the page itself after you'vbe called getEntry
or getCollection
, you should find the real path for the image because by that point it will have been replaced. In your example this isn't working because it's referring to non-existent images, so they can't be processed.
That prefix is used internally to track image imports. You're trying to read them at the wrong time. If you check the data in the page itself after you'vbe called
getEntry
orgetCollection
, you should find the real path for the image because by that point it will have been replaced. In your example this isn't working because it's referring to non-existent images, so they can't be processed.
This doesn't help me fix my problem. How are images being resolved. Do I have to place them in the content folder?
That prefix is used internally to track image imports. You're trying to read them at the wrong time. If you check the data in the page itself after you'vbe called
getEntry
orgetCollection
, you should find the real path for the image because by that point it will have been replaced. In your example this isn't working because it's referring to non-existent images, so they can't be processed.This doesn't help me fix my problem. How are images being resolved. Do I have to place them in the content folder?
Nevermind I figured it out
I'm glad you solved it. For anyone else finding this: image paths are relative to the content file