Thumbnailable

QName: f:thumbnailable

Configures a node to automatically generate thumbnails for the node content or attachments.

With this feature applied, one or more thumbnail images will be generated based on the node's JSON or attachment content. These thumbnails can be of various sizes and are automatically generated when the node's content is created, updated or deleted or its relevant attachment is updated.

Thumbnail generation is always synchronous. Thumbnails are generated when the node's JSON and/or attachments are created, updated or deleted.

Configuration

Property Type Default Read-Only Description
{thumbnailId} object This simply a unique ID containing a configuration block that drives the thumbnail generation. You can have as many thumbnail configurations as you would like.

Each thumbnail configuration supports the following options:
  • mimetype - (required) the desired mimetype of the thumbnail
  • source - (optional) the attachment ID to serve as the source of the thumbnail generation (defaults to "default")
  • width - (optional) the integer width of thumbnail
  • height - (optional) the integer height of thumbnail
  • compression - (optional) the compression level (0 for no compression, 10 for full compression or leave empty for default)
  • crop - (optional) crop information (crop.x, crop.y, crop.width, crop.height)
  • scale - (optional) scale information (scale.x, scale.y)
  • rotate - (optional) the amount of rotation to apply (i.e 90 or -270)

Compression is supported for JPEG and PNG mimetypes.

Example #1 - Different Sizes and Compression

Here is an example configuration with three different thumbnails, each sized differently and each in a different output format. This generates thumbnails for the "default" attachment by default. If a default attachment does not exist, an image of the JSON will be used. To generate thumbnails for a different attachment, use the source attribute.

{
    "_features": {
        "f:thumbnailable": {
            "thumb500": {
                "mimetype": "image/png",
                "width": 500,
                "height": 500
            },
            "thumb300": {
                "mimetype": "image/gif",
                "width": 300,
                "height": 300,
                "compression": 10
            },
            "thumb150": {
                "mimetype": "image/jpeg",
                "width": 150,
                "height": 150,
                "compression": 0
            }
        }
    }
}

Example #2 - Cropping with Scale and Rotation

This example scales the images to 75% of their original size, rotates the 90 degrees to the right and then crops a section in the middle. The crop has top-left coordinates of 50, 50. It has a width of 320 pixels and a height of 240 pixels. The result is saved as a Jpeg.

{
    "_features": {
        "f:thumbnailable": {
            "crop1": {
                "mimetype": "image/jpeg",
                "scale": {
                    "x": 0.75,
                    "y": 0.75
                },
                "rotate": 90.0,
                "crop": {
                    "x": 50,
                    "y": 50,
                    "width": 320,
                    "height": 240
                }
            }
        }
    }
}