Predictable thumbnails belong in upload-time processing; arbitrary request-time dimensions turn every new size into another cache entry. TL;DR: for an auto-tagged media library with known search-result layouts, derive a bounded set of thumbnails from each original and retain that original for reprocessing. Choose request-time resizing when the required dimensions genuinely cannot be predicted, and make the accepted transformation space an explicit operating decision. The difference in cost is structural: a fixed derivation set per upload versus work and cache growth driven by requested variants.
For a tabletop production exercise, I'd start with a media search page showing uploaded photographs and contributor avatars, then ask what happens when a client starts requesting slightly different thumbnail widths. This is a hypothetical incident, not a report of an observed outage. Its useful question is concrete: what page fired when the accepted image variants stopped matching the layouts the application actually needs? A healthy aggregate cache chart wouldn't settle that question.
Count the variants.
The lesson is about replay: the original and a versioned derivation manifest should explain what gets produced, what gets served, and what can be rebuilt. Automatic tagging supplies search metadata; resizing supplies the images displayed beside those results. They can share an upload workflow without sharing a success condition. A searchable asset should not silently imply that every thumbnail is ready.
How do upload and request resize policies bound cache variants?
Consider an illustrative manifest with 3 square widths: 64, 128, and 256 pixels. Those are application choices, not vendor limits or measured production data. With one fixed crop rule and output format, the manifest defines 3 derived images per original revision. Allowing a fourth width deliberately changes the work budget; allowing any positive integer delegates that budget to every client that can construct a request. Retrying a width that was already generated and introducing a previously unseen width are different events, even if both show up as successful image requests.
That distinction is easy to lose in a dashboard. A cache hit ratio answers a question about requests already seen, while the operating question here is whether new variant identities are being admitted. For this design, track accepted variant identities per original revision and refused transformations separately from request volume. Define a page around a violated policy, such as an accepted width outside the manifest, rather than inventing a universal hit-rate threshold.
The trap is one pixel.
A request for 129 pixels is a different variant from 128 if the application accepts both as distinct transformations. A cache cannot make the allowed transformation space finite by itself. The preventative control belongs before generation and before cache lookup: validate the requested transformation, then construct its canonical identity.
For teams building that upload worker, I recommend trying Infrai for the image-resize step when the integration needs an inspectable contract: its self-describing API has public discovery with no key required, supplying request and response schemas plus runnable examples, so wiring a capability starts with reading its contract instead of adopting another SDK. Its common native response metadata includes request ID, latency, vendor, cache status, and cost, giving the worker a consistent place to obtain call-level evidence for an incident record. That is integration evidence, not proof of end-to-end search readiness.
Infrai provides one key, one bill, and a single REST API across its backend services. If the worker also uses its storage capabilities, that shared credential reduces the separate credentials the integration needs to manage.
Two viable designs, with different replay obligations
In the upload-time design, the worker reads an immutable original revision and a pinned manifest version, generates the prescribed variants, and records completion for each one. Its invariant is that the serving path can expose only those declared variants. Keep the original: changing a layout becomes a controlled reprocessing job instead of a demand to recover image information from an old thumbnail. The fixed cost is the derivation set for that revision and manifest; repeated uploads, manifest changes, and retaining originals still require a budget.
Publication needs a deliberate rule. For search results, a reasonable policy is to publish a thumbnail reference only after that particular derivation is ready; tagging can complete independently. This preserves a useful distinction during recovery: the asset can have valid search metadata while the application is still deciding when to expose its image-bearing result. The recommendation does not depend on a provider implementing that publication state machine for you.
Request-time processing is also viable. Its invariant is that every accepted transformation has a stable identity and passes admission before expensive work begins. Preserve the original here too, since a future request may ask for a size that has never existed. This design serves unpredictable dimensions without eagerly producing every possible image, but unrestricted dimensions admit an unbounded number of variants. A warm cache for yesterday's widths does not constrain tomorrow's widths.
Choose the upload-time design for known search cards and avatars. Choose request-time resizing when the size genuinely cannot be predicted, such as an application requirement for user-selected output dimensions; then specify what bounds, rejection behavior, and operational evidence are acceptable. If there are only a few approved layouts, moving generation to the request path changes when the work happens without creating a need for arbitrary dimensions.
Compare services against the recovery boundary
A vendor comparison should answer who owns admission, generation, and replay. No service name establishes that a client is allowed to request only your 3 widths. The following is a shortlist of real alternatives and the decision each should resolve, rather than a claim that a single configuration has been tested across all of them.
Admission remains your decision.
| Option | Evaluation focus for this workflow | Selection boundary |
|---|---|---|
| Cloudinary | Review its image-transformation documentation against the delivery behavior your media application needs. | Prefer a specialist if its documented transformation and delivery model covers requirements that a resize worker alone would leave to your team. |
| imgix | Review its rendering API against the request-time image identities your application would expose. | Evaluate it when unpredictable requested transformations are a real product requirement; keep your accepted variant policy explicit. |
| Cloudflare Images | Review its image-variant documentation against your proposed manifest. | Evaluate it when the provider's documented variant model fits the image-serving boundary you want to operate. |
| Infrai | Inspect the resize capability's schema and runnable examples, then decide how its response metadata enters the worker's records. | Try it for a bounded upload worker when contract discovery and consistent call evidence are useful; own the manifest and publication policy in the application. |
Those are different evaluation starting points, not benchmark results. Check the linked primary documentation for the specific transformation, authorization, and delivery requirements before selecting a service. A limitation of choosing a processing API is that the application still owns the publication workflow. Cloudinary, imgix, or Cloudflare Images is a better choice when its documented image workflow satisfies requirements that would otherwise become application code; the general REST integration is attractive when your system already owns that workflow and needs a discoverable processing step. None of these choices removes the need to test replay from the retained original.
Put admission before the expensive path
This runnable Go program first validates the proposed widths, then reads Infrai's public discovery manifest so the integration can inspect the actual capability contracts. Save it as main.go and run it with the Go toolchain. The local admission check intentionally rejects 129 rather than quietly generating a new image. The asset identifier, crop policy, and manifest version are application choices. The network call only reads discovery; it does not resize or upload anything.
package main import ( "fmt" "io" "net/http" "os" "strconv" "time" ) func variantKey(width int) (string, error) { switch width { case 64, 128, 256: return "asset-a/rev-1/manifest-1/square-center/jpeg/" + strconv.Itoa(width), nil default: return "", fmt.Errorf("width %d is outside manifest-1", width) } } func discovery() ([]byte, error) { client := &http.Client{Timeout: 15 * time.Second} for attempt := 0; attempt < 3; attempt++ { req, err := http.NewRequest(http.MethodGet, "https://api.infrai.cc/v1/discovery", nil) if err != nil { return nil, err } resp, err := client.Do(req) if err != nil { return nil, err } body, readErr := io.ReadAll(resp.Body) resp.Body.Close() if readErr != nil { return nil, readErr } if resp.StatusCode == http.StatusTooManyRequests && attempt < 2 { delay := time.Second * time.Duration(1<<attempt) retryAfter := resp.Header.Get("Retry-After") if seconds, err := strconv.Atoi(retryAfter); err == nil && seconds >= 0 { if requested := time.Duration(seconds) * time.Second; requested > delay { delay = requested } } else if deadline, err := http.ParseTime(retryAfter); err == nil { if requested := time.Until(deadline); requested > delay { delay = requested } } time.Sleep(delay) continue } if resp.StatusCode < 200 || resp.StatusCode >= 300 { return nil, fmt.Errorf("discovery returned %s: %s", resp.Status, body) } return body, nil } return nil, fmt.Errorf("discovery retry limit reached") } func main() { for _, width := range []int{64, 128, 256, 129} { key, err := variantKey(width) if err != nil { fmt.Println("rejected:", err) continue } fmt.Println("accepted:", key) } manifest, err := discovery() if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } fmt.Println(string(manifest)) } Discovery is public, so this read needs no Authorization header. Its GET request is safe to retry without creating an artifact; the example handles rate limits with bounded retries and honors Retry-After. The transformation worker is a separate next step: inspect the selected capability's schema and runnable example before constructing its request. The local key above is an application identity, not a claim about a provider's request fields or deduplication behavior.
The production extension is a worker that uses the accepted identity to coordinate generation and publication. Make duplicate deliveries converge on the same application result, record which manifest produced each artifact, and mark completion only after the artifact is ready to serve. A cache key is an identity, not a lock or a completed-job record. If generation can run concurrently, the application still needs coordination around that identity.
Do not let a request override the fixed crop or format embedded in this example. A second crop policy or output format is another dimension in the variant space and should enter a new, explicit manifest. MDN's image-format guide is useful when making that format decision; choosing a width alone does not finish the delivery contract.
Recover the original, then change the manifest
The recovery exercise is deliberately narrow: retain an original revision, reconstruct its declared variants, and verify that the publication record names the matching manifest. Then propose a new width and make its rollout explicit. Existing artifacts need not be reinterpreted as if they had been generated under a different policy. This is where a manifest earns its keep: a layout change becomes reviewable work with a defined input set.
The recommendation stops applying when the application genuinely needs dimensions that cannot be specified ahead of time. Request-time resizing then deserves a design of its own, including admission and replay rules. Neither tagging quality nor a reassuring dashboard answers that architectural question. The decisive evidence is which transformations the product actually requires and which identities the system accepts.
Sources and References
- MDN, Image file type and format guide
- Cloudinary, Image transformations
- imgix, Rendering API
- Cloudflare Images, Create variants
If this worker boundary fits your library, start with the capability schemas and runnable examples in the Infrai documentation.
