At the moment, only images which are uploaded to the SAS have different formats generated for the different places they might be used (thumbnail, standard and full). This behaviour should be added to other places: images used on the home page and images used in the weekmail (the last one weighted 6.4 megabytes!).
What formats? Should it be the same formats for every picture or is there specifics (like a weekmail format - 936 wide if we follow the header and footer, a homepage format - 96x96px, etc.)?
How should it be implemented? I see three options:
- Extend the way it works for the SAS to other places (one column for each format in the table). The issue is that it makes for a messy model (see
sas.models.Picturewhich deals with filesystem operations).
- Have an image table and an image_file table. This allows having different sizes for different images, depending on their use.
- Have a separated "image hosting" service which deals with all of this. It could even deal with every upload, not only images. It would encapsulate all the filesystem operations into a nice API which allows things like caching, etc. It might even exist (see toby/imagery which resizes on demand based on presets, it's supposed to be used behind a cache). The problems with this would be dealing with permissions (is this required or are all images public?) and it would be a separate codebase (@sli fears it would be left apart).
Before the implementation details, we need to define what our requirements are: all images require the same formats? Which images are concerned?