Integrate Imagizer using a Cloudflare worker
This project requires NodeJS with the NPM package manager.
Clone this project
git clone [email protected]:Nventify/imagizer-cloudflare-worker.git
cd imagizer-cloudflare-worker
Install with NPM
# Install CloudFlare Wrangler
npm install @cloudflare/wrangler -g
# Install Project Dependencies
npm install
Login to your Cloudflare account and authorize this project.
wrangler login
Once authorized, update the wrangle.toml file with the following information.
- The Cloudflare Zone ID, which can be found in the Cloudflare dashboard.
- A route which matches your image locations. (ex:
*example.com/product-images/*
) - An Imagizer source domain. If you do not already have an Imagizer source domain, follow the steps in our docs here.
Publish the worker to your Cloudflare account.
wrangler publish
Congratulations! Your images will now be optimized through Imagizer.
Monitor the logs from the worker
wrangler tail --format pretty
You may remove the worker from the worker settings page on the Cloudflare Dashboard.
NOTE
You may need to review the Cloudflare Worker payment plans. Their free plan will cover up to 100,000 requests a day.
See our Cloudflare Integration docs for more information.
See Cloudflare's Wrangler docs for more information on the deployment process.