Added image filesize validation and some refactoring

Can't see any explanation of it there, so I'm pretty sure it's a mistake. Also, the for loop can be replaced by `({{ allowed_extensions|join:"|" }})`