In the last few weeks, I experimented quite a bit with BunnyCDN and Ghost. My goal was to make Ghost sites hosted on a server in Germany available quickly worldwide. Naturally, the further a user was from my server, the longer it took for the website to load.
My first approach was setting up the “classic” BunnyCDN. For an individual website this works great, in my opinion. I posted my findings here:
However, my goal was to make the speed-benefit replicable without having to set up DNS zones etc. – specifically for some of my customers’ websites.
So…I wanted to try an approach with a BunnyCDN storage adapter for Ghost. A day later, here we are:
Feedback, comments, and suggestions are welcome, of course
The image resizing doesn’t work with this adapter, no. Generally, there is a big conflict between the way Ghost handles the image resizing and storage adapters. For Magic Pages I ended up using a different approach with an S3 adapter and ran into the exact problem yesterday. Wrote a little bit about it here: Transform image CDN to full-site CDN
Long story short: the uploading to storage wouldn’t be much of a problem. Generating the srcset will be – because Ghost only does that when the images are served locally. I haven’t figured out a good way to “simulate” that with a storage adapter.
The tricky part seems to be less about where the images are stored and more about how Ghost handles responsive image sizes. Moving uploads to BunnyCDN storage works for serving the original files, but Ghost’s native resizing relies on images being served locally, so generating the usual srcset URLs becomes the main issue.
A possible workaround would be to keep the originals in external storage and handle resizing separately, with the CDN caching the generated versions. That would require some control over the image URLs in the theme, though, rather than relying entirely on Ghost’s built-in image handling.
Ghost has a “urls.image” config parameter that allows you to use an external URL with the same dynamic image URLs of Ghost. So, you can upload your images to an external storage, and by handling on-the-fly image resizes by yourself, you can still use the advantage of the img_url helper. For more information: Configuration - Ghost Developer Docs
This is how we at Synaps Media and Ghost(Pro) serve images over an external domain while still having auto-resized images.