Cloudflare image resizing with workers

Hey, i want to know about the pricing…
If i use a worker with Cloudflare image resizing. When it request, Cloudflare workers execute. Correct me if i am wrong so will be billed for Cloudflare image resizing and Cloudflare workers both or only workers. I am using bucket with Cloudflare workers with Cloudflare image resizing

That is correct, you will be billed for both.

To reduce usage, I’d recommend using the cache APIs in front of your image resizing requests.

@cherryjimbo thanks but aren’t Cloudflare resized images already cached, what effect will it put if we use cache API

Yes but I’ve often found the cache api provides nicer and more direct control. The Images caching is a bit of an unknown, whereas the cache api gives you much finer control. It’s a preference thing, but that’s just my experience.

So that means if i use caching API with workers, i won’t be charged for other subsequent request for the same file as it is cached?

You’ll be charged for the worker invocation, but not the image resizing request as long as it has been requested previously in the same location, and not evicted from the cache.

Are we billed for cached requests when using worker? In one forum they to use page rule so that workers is not invoked for cached requests

Workers are always invoked before any other cache. You’ll be billed for an invocation even if you just serve from cache, yes.

So correct me if i am wrong. Is it possible that. If a image is resized than it’s in cache and for subsequent request as it is hit, no request is passed to origin or the workers hence no cost for workers. But when there’s a miss, the image will be taken from workers workers will cache using cache API hence charges for workers+ image resize

Ok last modal, tell me if this would be possible. It’s confirm Cloudflare image resizing is billed on miss requests but what if there’s never a miss let me explain in detail.

For now let’s consider we have image file in R2, using Cloudflare workers with cache API. If we get request for that file , if it will look in cache if miss it will look in R2 that will be hit for that file as it’s present. As it’s hit. Image resizing won’t be billed.

Something like cache reserve

@cherryjimbo is it possible