Renditions are a representation of source content in another form. A Rendition Definition (JSON) defines the transform option (parameter) values that will be passed to a transformer and the target Media Type.
{ "renditions": [ { "renditionName": "helloWorld", "targetMediaType": "text/html", "options": [ {"name": "language", "value": "German"} ] } ] }
- renditionName - A unique rendition name.
- targetMediaType - The target Media Type for the rendition.
- options - The list of transform option names and values corresponding to the transform options defined in T-Engine configuration. If you specify sourceNodeRef without a value, the system will automatically add the values at run time.
Just like Pipeline Definitions, custom Rendition Definitions need to be placed in a directory of the Repository. There are similar properties that control where and when these definitions are read and the same approach may be taken to get them into Docker Compose and Kubernetes environments.
rendition.config.dir=shared/classes/alfresco/extension/transform/renditions/
rendition.config.cronExpression=2 30 0/1 * * ? rendition.config.initialAndOnError.cronExpression=0 * * * * ?
In a Kubernetes environment:
kubectl create configmap custom-rendition-config --from-file=name_of_a_file.json
The necessary volumes are already provided out of the box and the files in ConfigMap custom-rendition-config will be mounted to /usr/local/tomcat/shared/classes/alfresco/extension/transform/renditions/. Again, the files will be picked up the next time the location is read, or when the repository pods are restarted.
Disabling an existing rendition
Just like transforms, it is possible to override renditions. The following example effectively disables the doclib rendition, used to create the thumbnail images in Share’s Document Library page and other client applications. A good name for this file might be 0200-disableDoclib.json.
{ "renditions": [ { "renditionName": "doclib", "targetMediaType": "image/png", "options": [ {"name": "unsupported", "value": 123} ] } ] }
Because there is not a transformer with an transform option called unsupported, the rendition can never be performed. Having turned on TransformerDebug logging you normally you would see a transform taking place for -- doclib -- when you upload a file in Share. With this override the doclib transform does not appear.
Overriding an existing rendition
It is possible to change a rendition by overriding it. The following 0300-biggerThumbnails.json file changes the size of the doclib image from 100x100 to be 123x123 and introduces another rendition called biggerThumbnail that is 200x200.
{ "renditions": [ { "renditionName": "doclib", "targetMediaType": "image/png", "options": [ {"name": "resizeWidth", "value": 123}, {"name": "resizeHeight", "value": 123}, {"name": "allowEnlargement", "value": false}, {"name": "maintainAspectRatio", "value": true}, {"name": "autoOrient", "value": true}, {"name": "thumbnail", "value": true} ] }, { "renditionName": "biggerThumbnail", "targetMediaType": "image/png", "options": [ {"name": "resizeWidth", "value": 200}, {"name": "resizeHeight", "value": 200}, {"name": "allowEnlargement", "value": false}, {"name": "maintainAspectRatio", "value": true}, {"name": "autoOrient", "value": true}, {"name": "thumbnail", "value": true} ] } ] }