egeldenhuys / ghost-cloudflare-r2

Cloudflare R2 storage adapter for Ghost
MIT License
25 stars 3 forks source link

Does this integrate with Cloudflare Images as well? #4

Open ajtatum opened 3 months ago

ajtatum commented 3 months ago

I'm considering Ghost CMS instead of another Wordpress site, but I have a WP plugin that saves images to Cloudflare images and thus WP doesn't save any size variants, and optionally the original image, and when a visitor comes to the site the image is shown with the exact dimensions required as detected by Cloudflare. In the end, it results in really clean images and no need to worry about image sizes whatsoever.

egeldenhuys commented 1 month ago

Hi @ajtatum, Unfortunately this plugin only stores images in R2 and not in their Images product.

It might be possible to use Cloudflare's Image Transformation functionality to resize images served from R2 using this plugin, but would likely require some rules (on Cloudflare or Ghost) to rewrite the URL from something like /content/images/size/w{width}/... to https://<ZONE>/cdn-cgi/image/<OPTIONS>/<SOURCE-IMAGE>. I think the theme determined which sizes were used in the image URL.

Sorry for being vague, it has been a while since I worked with the Ghost API and images.

It would be nice to have a storage adapter that integrates with Cloudflare Images. I don't know of any at the moment.

ajtatum commented 1 month ago

Alrighty, gotcha thanks! Just out of curiosity, you mentioned it's been a while since working with the API, do you still use Ghost and do you think you'll continue to maintain this repo? Sorry, I'm new to Ghost and just want to try and get things right. Off topic, but I'm honestly kinda stuck on if I want to move forward with Ghost. I've used WordPress in the past and loved its extensibility, but hate how badly the plug-in ecosystem is (poorly written code). With Ghost, modifying anything built in seems like a chore.

egeldenhuys commented 1 month ago

I recently started using Ghost again so I will still be maintaining this repo and reviewing pull requests. I want to improve the documentation on how to contribute and install the storage adapter, as well as better testing and quality control.

Personally I will be storing my images in R2 until it makes more sense to store in Images (you can store about 333 GB of images before R2 becomes more expensive than Images storage at $5).

It seems the image transformations are quite expensive whereas the variants are included in the cost if you store the images within the Images product.