Limit the transformation images variants

Hello team, I recently suggested cloudflare transformation images to client in order to serve responsive images where images are hosted elsewhere. Even though the pricing is cheap, client had this concern If we are getting charged per unique transformation, for example w=200, but lets suppose some bad actor know this url and can just write a script to run a for loop which will request image based on width from 1 to any number. I didn't have any answer to that. So came here to ask. Is there a way to pre define the transformation variant and if asked for other variants, i would just return with duplicate variant
3 Replies
Rocko
Rocko10mo ago
I'm also interested in this 🙋‍♂️
Chaika
Chaika10mo ago
You can use Image Transformations via Workers to implement specific presets and control what transformations can be done: https://developers.cloudflare.com/images/transform-images/transform-via-workers/
Cloudflare Docs
Transform via Workers · Cloudflare Image Optimization docs
Using Cloudflare Workers to transform with a custom URL scheme gives you powerful programmatic control over every image request.
w3bcode
w3bcodeOP10mo ago
yeah found this later. Using workers for this use case. thanks
Want results from more Discord servers?
Add your server