Accessing Image Representations

A field defined in this way in the content-type resource will be presented as a complex field (that is, a map) in PresentationArticle beans. Each item in the map holds a representation, indexed by its name. To access the representations in a PresentationArticle bean containing a content item of the type defined above, for example, you could use the following expressions:


Each representation is itself a map containing the following fields:


The width of the crop mask in pixels.


The height of the crop mask in pixels.


The width of the original image in pixels (only present in derived representations).


The height of the original image in pixels (only present in derived representations).


The URL of this representation.


Information about the crop mask.

To include an image representation in a template, therefore, you would do something like this:


The sourcewidth and sourceheight values included in derived representations makes it possible to calculate how much of the original image is included in the representation. This information might be used to estimate the probable quality of the cropped image and determine how it is presented in the output.