Skip to content

componentImageStorageServer

Sebastian Schlicht edited this page Sep 3, 2013 · 21 revisions

This component provides images and is responsible for all related works like analysing meta data, cropping and rotating images.

Requirements

  • [NewsStream] the image server should be able to provide a user avatar using a static page e.g. including the user's global key
  • [Fans] user self publication
  • [other Websites] providing content for external sites (image hosting/presentation)
  • [Venues] providing the possibility to host event pictures

API specification

Create

There are two ways to create an image:
Firstly you can upload a binary image file of any image type supported by ImageMagick such as JPG, PNG, GIF or WEBP. (http://www.imagemagick.com/www/formats.html)
You may pass cropping information for manual cropping then. The server may rotate the image automatically using the EXIF data of the image if you do not use cropping.

Secondly you can pass an URL referring to an existing image.

Independent from the method you choose: The server handles images using an unique identifier. In addition the server will store meta data that is getting extracted from the image itself but that can be extended by passing additional meta data. Meta data passed separately overrides the EXIF data.

Read

There are two ways to read images: Firstly you can read a single image accessed by its identifier including the meta data stored.

Secondly you can read a couple of image by passing a list including as many identifiers as you want. The response will be an archive file containing all the images requested then. This second retrieval method is proposed for thumbnails.

Independent from the method you choose: You must specify either the dimension of the file(s) you want to retrieve or pass the original image flag to retrieve the original image. You can not request a size larger than the size of the basic file, that already includes the manual cropping.

Update

You can not update an image but you can add key value pairs to the meta data.

Delete

You can delete an image by passing the image identifier. The image will be removed from the album automatically.

Implementation details

The server stores images in their original version at least. If the image was cropped and/or rotated we will store the generated version and the cropping information in a database for retrievals. Each retrieval that provides an image size that is not existing yet will lead to a new image file having this dimension, as we assume the hard disk space wasted to be less expensive than the CPU time to compute the file to this dimension another time.
To compute the new version we use the basic JPEG image (already including our filters such as cropping and rotation).

We will hash the image identifiers to achieve a balanced directory tree.

So the directory tree will look like:

  • hash(image-id)[0..n]
  • basis [JPEG, may be cropped and/or rotated]
  • 150x150
  • 300x150
  • ...
  • originals
  • year of upload
    • day of upload
      • hash(user-id)[0..n]

A database will hold the meta data of an image.

Features

Technologies

Responsible Developer

  • Christian
  • Sebastian
Clone this wiki locally