Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 2.13 KB

README.md

File metadata and controls

34 lines (21 loc) · 2.13 KB

👷 image-resizing

Image resizing for Ghost blog image content using Cloudflare

Vortexmind Known Vulnerabilities Maintainability codecov

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

Installation

Use the button below to deploy the worker automatically to your Cloudflare zone

Deploy to Cloudflare Workers

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

Features

  • 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 than 1000 , then 1000 is used.
  • If an error occurs, the original image is loaded from the origin server.
  • metadata is stripped except copyright