I understand it is most likely impossible, but I'm also open to other suggestions.
The problem here is simple, I have this backend API which receives a list of URLs containing very large images, which then are downloaded, resized, zipped and sent back.
There's a maximum size allowed for all resized images togheter, problem is I'm calculating the size client-side only, so if someone maliciously sends very large images it will probably overload the server memory as all the logic is handled in-memory.
Is there a way for me to validate this server-side? From a list of URLs containing images of no particular pattern/size I want to know if their total size after resizing them will pass a certain limit
I know its possible to know the image size by looking at the content-lenght header, but not sure if I can estimate/calculate the size after resizing, specially not knowing the dimensions.
I'm tagging python and PIL as these are the tools I'm using but I'm not sure if any code is necessary here, its mostly a conceptual question.