Urgent.News

What's breaking now, across thousands of outlets.

Tech

Capacity Planning a Browser Image Upload to Object Storage and Backend Thumbnails

Short answer: let the browser upload the original image directly to object storage with a narrowly scoped, short-lived signed request, then have the backend verify the stored object and create thumbnails asynchronously under separate immutable keys. Proxy the bytes through the application when validation must happen before storage, the client cannot reach the storage endpoint, or the signing…

The ideal approach for uploading images to object storage and generating thumbnails is to let the browser handle the original image upload directly to storage. This can be achieved using a narrowly scoped, short-lived signed request that authorizes the specific operation. After the upload is successful, the backend verifies the stored object and initiates thumbnail creation asynchronously under a separate immutable key.

The application should proxy the bytes through the backend when validation is required before storage, when the client cannot reach the storage endpoint, or when the signing mechanism cannot enforce the necessary constraints. It's crucial to treat the original image and all derivatives as distinct lifecycle states rather than a single file being overwritten. Each state should be recorded in a database: requested, uploaded, verified, processing, and ready.

A separate database record should own the transitions between these states, ensuring proper tracking. The public application should not consider an image ready merely because the browser reports the upload as completed. This process is an SLO (Service Level Objective) problem disguised as a form submission. By making the boundaries explicit, capacity planning becomes simpler.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Sunday 8 November →