Open nathansebhastian opened 3 years ago
Hey
I actually encountered that too and that's why in the end and ended up uploading all images to a Cloudinary account :/
I do not have a workaround, sorry
Hi Sara,
No worries! I have managed to create a workaround by adding a new image renderer that replace the relative path with absolute path to the image src
like this:
export const absoluteImageRenderer = ({ src, alt }) => {
src = src.replace("./", "http://localhost:9000/")
return (
<figure>
<img src={src} alt={alt} />
<figcaption>{alt}</figcaption>
</figure>
);
}
Then call it only under GATSBY_SCRAPPER:
process.env.GATSBY_SCRAPPER === "1"
? {
heading: headingRenderer,
root: SmallRootRenderer,
image: absoluteImageRenderer,
}
:
I'm using localhost:9000
because gatsby serve
the local site there. May I create a pull request on this issue? Then you can review it afterward :)
Heyy
That is smart!!!
Please do :)
Hello Sara,
I tried to generate an epub book with the script, but I have image download error from my console:
It seems that the epub-gen library can't download images unless it's absolute path or HTTP? Is there a workaround for this?
Thank you!