Integrate Imagizer using a Cloudflare worker
This project requires NodeJS with the NPM package manager.
Clone this project
git clone git@github.com:Nventify/imagizer-cloudflare-worker.git
cd imagizer-cloudflare-workerInstall with NPM
# Install CloudFlare Wrangler
npm install @cloudflare/wrangler -g
# Install Project Dependencies
npm installLogin to your Cloudflare account and authorize this project.
wrangler loginOnce 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 publishCongratulations! Your images will now be optimized through Imagizer.
Monitor the logs from the worker
wrangler tail --format prettyYou 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.
