Skip to content
Tobias Sauerwein edited this page May 3, 2016 · 3 revisions

Images have a document stored in the database (like other document types). The files are stored in a file storage service hosted on our own servers (e.g. Ceph).

The image upload will work as follows:

  • The interface and UX will be like in v5. A user selects images either by drag&drop or with the file selector.
  • As soon as images are selected, a thumbnail generated on the client-side is shown.
  • At the same time the images are uploaded in the background to the API (only the images, no other image document attributes like the title). Each image with a separate request. A progress bar is shown to let the user know the image is still uploading.
  • On the API server side, the images are stored in a temporary folder in the file storage service and the thumbnails are generated in a blocking manner.
  • During the upload the user can set a title or other attributes for the image document.
  • When the user clicks 'Save', the JS logic will wait until all images are uploaded (or the save button is disabled until then), then a single request sends the image attributes to the API. This will create the actual image document and moves the image files (original file + thumbnails) from the temporary folder in the image service to the real location.

For the API we will need the following views:

  • POST /images/upload Expects a single image file, stores the file in a temporary folder and generates the thumbnails. Returns an identifier.
  • POST /images/ Expects a list of image documents (identifier + image attributes). Moves the image files to the image service and creates the image documents. Returns a list of document ids.

Additionally a clean-up task removes unused temporary images (e.g. not used for 1d).