Every uploaded image needs six sizes and the thumbnail has to appear immediately. What runs before you return, and what does not?
Thumbnail generation system design should return one displayable image immediately while every durable variant is produced asynchronously. Persist the original, write metadata, show a client-side preview or first small thumbnail, and expose variant readiness so the UI never asks for an image size that is not ready.