Skip to content

componentImageApplicationServer

Sebastian Schlicht edited this page Oct 25, 2013 · 5 revisions

API specification

Create

Image

There are two ways to create an image: Firstly you can upload a binary image file (of any image type supported by ImageMagick). You may pass cropping information for manual cropping then. The server may rotate the image automatically using the EXIF data of the image.

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. Each image must be part of an album. You have to pass additional meta data that extends the EXIF data of the image to have meta data that is altogether according to the image meta model. Meta data passed separately overrides the EXIF data.

Does this happen for binary files only? How do we know the license and so on? Do we have to know? What do we allow to override? Timestamp of creation? Author?

The first image of an album gets the album cover automatically. (Middleware now)

Read

Image

Reading of thumbnails must be able base64 encoded.

Frontend

Gallery

  • multiple images with a certain height -> JSON String including
  • image meta data (only relevant parts?)
  • width of the scaled image
  • image identifier
  • single request for each image having a certain height using the accessor -> base64 encoded JPEG (binary) Detailed image view
  • single image has to be accessible via an URL fitting a certain frame -> base64 encoded JPEG (binary)

Requirements for Middleware:

  • gallery data for an entity/album
  • JSON String mentioned above
  • single image having a certain height
  • meta data for an image
  • single image fitting a certain frame
  • user information for a user
  • profile picture
  • number of comments for an image

new version

Image application server

The service that will run as a true web server will be the application server. It is already specific for the Metalcon use case since it makes sure all requirements from other Metalcon services are fulfilled. This does not mean that we could not deploy it to Maven too, but there may be no need to do so.

Create

Cropping of images is a necessary feature in Metalcon used for profile pictures.
Metalcon may not need the application server to crop images since this could happen at client side if JavaScript is enabled. This would take load from the CPU and reduce network traffic due to the image sizes. In fact the server should support cropping so Metalcon is able to gain the original image - JavaScript must still be enabled to gather the cropping information. [?]

createImage [?]

  • identifier [String]
  • metaData [String]
  • croppingInformation
  • left [int]
  • top [int]
  • width [int]
  • height [int]

Metalcon does need the application server to create an image with auto rotation, as it is a nice feature for gallery images. The server may be able to create images without the auto rotation too, since it may not be wished by the user. [?]

createImage

  • identifier [String]
  • metaData [String]: JSON String containing meta data, checked if valid ImageMetaData
  • image [InputStream]
  • autoRotate [boolean]: [?] see above

Create images from URLs is a necessary feature in Metalcon.
It enables users to

  • add images from third party services such as Flickr
  • post a link to a picture
  • post a link having a thumbnail

JavaScript should be used at client side to download the images locally first to give the user a preview and to stress the image application server only if the image is really created.

createImage

  • identifier [String]
  • metaData [String]: JSON String containing optional meta data, checked if valid ImageMetaData; source URL will be added [?]
  • imageUrl [String]

Read

readImage

Metalcon does not need to read an image in its basic version directly. In fact Metalcon will always use scaled versions to reduce the network traffic.

readImage

  • identifier [String]

readScaledImage

Metalcon uses scaled versions of images for profile pictures, the news stream, the gallery and the detailed view of an image. [?]

readScaledImage

  • identifier [String]
  • width [int]: width of the new image frame
  • height [int]: height of the new image frame
  • scalingType [ScalingType]: specifies the way the image scaling should happen

ScalingType

  • FIT: downscale image until it fits in the frame
  • WIDTH: downscale image until the width matches the frame width
  • HEIGHT: downscale image until the height matches frame height
  • FILL: scale the image so it fits the frame - may change aspect ratio

readScaledImages

Metalcon needs an additional method to read multiple images having the same size.
The method will be used for small thumbnails to reduce the number of requests.
Thumbails will be used in the following services/modules:

  • news stream (user profile pictures)
  • tab previews
  • users
  • bands
  • photos
  • venues
  • records

This method is not for the general purpose as we have to choose an archive file type and do only reduce the number of HTTP requests - which is not applicable for the embedded server.

readScaledImages

  • identifiers [CSV String list]: identifiers of the images you want to access
  • width [int]
  • height [int]
  • scalingType [ScalingType]

readScaledMetaData

Metalcon needs an additional method to read the meta data for a bunch of scaled images without retrieving the images themselves. This is for the gallery view that needs to know the widths of multiple images that will be retrieved in short. The meta data will return all the meta of the images and in addition the width the scaled image version will have. You have to pass the height only while the scaling type will be assumed being HEIGHT.

readScaledMetaData

  • identifiers [CSV String list]
  • height [int]

readOriginalImage

Metalcon needs to read the original image if the uploader wants to access it and may need it for the reporting system.

readOriginalImage

  • identifier [String]

Metadata models

Image

To be provided by user when creating (Middleware)

  • author
  • name
  • user identifier [optional]
  • timestamp of creation
  • uploader
  • user identifier
  • IP address
  • license
  • [editable] title [optional]
  • [editable] description [optional]
  • [editable] linked entities [optional]
  • venue
  • band
  • user (image coordinates) [optional]
  • [editable] geo data passed by user, determined by IP address [optional]

Determined at server side when creating

  • timestamp of upload
  • [editable] number of views
  • [editable] geo data [if GPS tag available in EXIF data]

Album

  • [editable] title
  • [editable] description [optional]
  • owner identifier
  • list containing the identifiers of all images in the album
Clone this wiki locally