A Cloudflare Worker that uses Cloudflare's Image Resizing API to automatically compress any image served from the content/images/
path on a Ghost blog.
ℹ️ Image resizing is available to Business and Enterprise Cloudflare plans
Use the button below to deploy the worker automatically to your Cloudflare zone
Or you can clone the repository and use wrangler
to deploy it.
Once deployed - to activate it you need to configure a route to your /content/images
path to the worker
For example
https://www.yourblog.com/content/images/*
This ensures that image requests under that path are intercepted by the worker and resized as appopriate
- The worker resizes images that have a
/size/w<NUMBER>/
in the URL. For all such URLs, the worker will pull the original, unresized image and use it as a base for resizing. - The image is resized to the width provided in the
w<NUMBER>
path element. If the image does not have a size, or as a size greater than1000
, then1000
is used. - If an error occurs, the original image is loaded from the origin server.
metadata
is stripped exceptcopyright