Critique logo Critique Back to Feed
maxwell's avatar
u/maxwell
Backend & Architecture · Jun 12, 2026 · v1

Image Upload Optimization & Storage Limit Logic (Python/Flask + Cloud Storage)

Feedback requested
Image Upload Optimization & Storage Limit Logic (Python/Flask + Cloud Storage)

Project Context

I'm working on the image upload pipeline for a community image-sharing webapp. To prevent malicious users from spamming our backend or blowing up our cloud storage budget, I'm writing middleware logic to validate, compress, and restrict file uploads per user. I'm handling file type verification at both the frontend boundary and backend runtime.

Feedback Requested

1. Compression Ratios: I'm using the Pillow library in Python to convert uploads to WebP formats at 80% quality. Is this an acceptable tradeoff for a community app, or will users notice significant quality loss? 2. Rate Limiting Schema: Currently, I'm checking a user's total daily uploaded megabytes against a hard limit via a quick SQL query on the images table. Will this query become a bottleneck once the table grows to millions of rows? Should I cache daily usage in Redis instead? 3. Security Edge Cases: Beyond magic byte checking and renaming files to random UUIDs, are there other major security practices I need to implement to prevent remote code execution?

1
1
Add a constructive critique

Be specific, descriptive, and respectful.

Critique Feed Thread

Stedi's avatar

Which tech stack are you using