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

<thead>
    <tr>
        <th>Property</th>
        <th>Type</th>
        <th>Default</th>
        <th nowrap>Read-Only</th>
        <th>Description</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>{thumbnailId}</td>
        <td>object</td>
        <td></td>
        <td></td>
        <td>
            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.
            <br/>
            <br/>
            Each thumbnail configuration supports the following options:
            <ul>
                <li><b>mimetype</b> - (required) the desired mimetype of the thumbnail</li>
                <li><b>source</b> - (optional) the attachment ID to serve as the source of the thumbnail generation (defaults to "default")
                <li><b>width</b> - (optional) the integer width of thumbnail</li>
                <li><b>height</b> - (optional) the integer height of thumbnail</li>
                <li><b>compression</b> - (optional) the compression level (0 for no compression, 10 for full compression or leave empty for default)</li>
                <li><b>crop</b> - (optional) crop information (<code>crop.x</code>, <code>crop.y</code>, <code>crop.width</code>, <code>crop.height</code>)
                <li><b>scale</b> - (optional) scale information (<code>scale.x</code>, <code>scale.y</code>)</li>
                <li><b>rotate</b> - (optional) the amount of rotation to apply (i.e 90 or -270)
            </ul>
        </td>
    </tr>
</tbody>

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
                }
            }
        }
    }
}