Information Classification: External Restricted.
See https://www.chili-publish.com/security

Extracting Preview Images

Concept

At various points throughout your portal's workflow, you may want to embed previews to CHILI resources (most specifically assets and documents). The URLs needed for this can be fetched using the Webservice Functions - ResourceItemGetURL calls. This function accepts a type as one of its arguments, which can be either a standard format, or a reference to an Image Conversion Profile.

Previews are cached by CHILI on the server, and will be automatically regenerated when they don't exist or are out of date.

By default, preview URLs requested by external applications will be generated on the fly. CHILI BackOffice and Editor, however, request asynchronous URLs (by adding "&async=true" to the download URL). This will either return the URL information, or a task descriptor if the image does not exist (or is invalid). See Asynchronous Tasks for more information.

Image format

Standard preview formats include thumbnail, full, etc: Webservice DataTypes - previewType

Next to that, you can add the ID of an Image Conversion Profile. These are maintained through the BackOffice, and can contain settings for image output on custom sizes. You can, for example, get a square preview, padded with a transparent or configured color, for easier integration into your HTML design.

 

In the Image Conversion Profile, you can select one of the 4 different scaling options:

None: this will output a preview based on the dimensions of the document

Exact: this will generate a preview that matches the defined dimensions in "width" and "height".
With this option, you'll get an additional option "padding color" where you can define a transparent or colored background for the whitespace in the thumb.

Fit inside: The image will rescale so that it fits within the dimensions provided.

Fit outside: The image will rescale until both the width and height are filled. Depending on the dimensions of your document, the image could exceed the width and height that you provided for the conversion profile.
Eg: if you would set the same measure for width and height in the conversion profile:
- for a landscape document the width of the preview would be larger than the width provided, but the height of the preview would match the height provided 
- for a portrait document the height of the preview would be larger than the height provided, but the width of the preview would match the width provided  

 


Caching URLs

While it is possible to cache preview URLs which have been returned, keep in mind that these also include the current api key, for authentication purposes. If you cache a preview URL in your own database, you should make sure that this gets replaced by a valid API key when embedding the URL inside your own portal.

All information on this page must be treated as External Restricted, or more strict. https://www.chili-publish.com/security