Previewable

QName: f:previewable

Automates the creation and updating of "preview" attachments for one or more attachments on this node. Preview attachments are secondary binary attachments that are the result of one or more transformation operations to the original attachment.

As an example, you might apply the f:previewable feature to a node that holds a PDF. The preview configuration lets you split the PDF into multiple pages and store snapshots of those pages as image/jpeg attachments on the node. The attachments can be resized or reformatted for your specific display device (iPhone, iPad, Android, and more).

Preview attachments are content transformations into a target mimetype (like JPG) for all of the content stored in the JSON or in an attachment for a node. A good example of to imagine uploading a heavy PDF file. This feature could generate resized JPG files for use in previewing all of the pages of the PDF on a mobile device.

Previews are generated whenever a node is created or updated or has its relevant attachment modified.

Configuration

Property Type Default Read-Only Description
schedule text Determines when previews will be generated.
Either synchronous or asynchronous.
previews object Defines the previews that you would like to have generated.

This supports multiple preview generations. You may want some preview images to be generated for an iPad device and others for an Android depending on the form factor (size, color options, etc).

This object consists of a named preview key and an preview config for the key.

Previewable Example

Here is an example of a node that stores a PDF attachment. When the PDF attachment is written, preview images are generated for two output formats.

{
    "title": "product_catalog.pdf",
    "_features": {
        "f:previewable": {
            "previews": {
                "ipad": {
                    "mimetype": "image/png",
                    "width": 1600,
                    "height": -1,
                    "prefix": "ipad",
                    "maxFileSize": 200000
                },
                "iphone": {
                    "mimetype": "image/jpeg",
                    "width": 512,
                    "height": -1,
                    "prefix": "iphone"
                }
            }
        }
    }
}