Ghost Gatsby Images


#1

I am trying to setup Gatsby site using Ghost Gatsby Starter, is there any way to fetch images as well?
I could see that images are linked from original ghost site only.


#2

Hey @BhanuK :wave:

This is how Ghost as headless CMS is intended to work. You’ll fetch the URL of the images, not download the image itself.

Of course you’re free to download the images from your /content/images/ directory in Ghost and import them into your image directory in Gatsby, but then all the references to those images from your Ghost posts, pages, tags, and authors are not working anymore.


#3

Gatsby has no concept of where image files are, it just gets HTML content from Ghost, and that HTML happens to contain img tags pointing at wherever the image was stored by the Ghost image uploader.

File storage can be changed via a storage adapter, this is part of the back end, rather than the front-end.

Whatever storage is used effectively acts like a media CDN, which works well. There’s no way to download local copies of the assets to the Gatsby build without also parsing and transforming all of the HTML content to point at the new location, which would be fragile at best.

TLDR: Use an image service for images, not Gatsby. Ghost has one built in, but you can also use others.


closed #4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.