cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure a LocalTransform rendition for multiple source image mimetypes

boneill
Star Contributor
Star Contributor

We are having problems registering a custom rendition to be available for multiple image mimetypes.  When it registers it is only available for the image mimetype that we first create a rendition for using the custom rendition.

We have configured a local transform as follows.  Its pretty much the same the doclib rendition except for a resize.

The config is as follows:

In shared/classes/alfresco/extension/transform/renditions/0050-nswtaAssetLow.json file
------------------------------------

{
"renditions": [
{
"renditionName": "nswtaAssetLow",
"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},
{"name": "startPage", "value": "0"},
{"name": "endPage", "value": "0"}
]
}
]
}

In alfresco-global.properties
---------------------------------------------------
transform.service.enabled=false
localTransform.core-aio.url=http://10.132.2.138:8090/
local.transform.service.enabled=true

rendition.config.dir=shared/classes/alfresco/extension/transform/renditions/
rendition.config.cronExpression=2 30 0/1 * * ?
rendition.config.initialAndOnError.cronExpression=0/10 * * * * ?

Note we are using the aio transform engine.

If we call the rendition service api to create a rendition for a source jpg file it works and creates a rendition as a thumbnail.

http://10.132.2.138:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/761cd2ff-a6af-4789-...

body:

{
"id": "nswtaAssetLow"
}

However, this custom rendition should be available for a png source file as well. If we call the same rendition api for a png file it fails and gives the error message:

{
"error": {
"errorKey": "framework.exception.ApiDefault",
"statusCode": 400,
"briefSummary": "Local transform nswtaAssetLow from image/png is unsupported",
"stackTrace": "For security reasons the stack trace is no longer displayed, but the property is kept for previous versions",
"descriptionURL": "https://api-explorer.alfresco.com"
}
}

The interesting this is that if we stop alfresco and restart alfresco and then call the rendition service for a png source file it works fine and creates the rendition thumbnail. However, now it is not possible to create a jpg thumbnail.

Am I missing something in how I register the rendition so it supports creating a rendition for both jpg and png source files.  I am very confused by this issue as from my understanding it should work for both png and jpg mimetypes once registered.  I therefore am wondering if I need to do something extra to register it to work for both mimetypes.

Regards

Brian

2 REPLIES 2

abhinavmishra14
World-Class Innovator
World-Class Innovator

May be referencing this project can help: https://github.com/aborroy/alf-tengine-markdown 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Hi Abhinav,

Thanks for the pointer.  I have considered this url as it is one of the few examples of how to create a custom transformer and hook into content upload.  I have also read the alfersco documentation on how to configure a new or orverride an existing rendition for localTransforms.  Having followed the same procedure as documented I find that my rendition request works.  However, it only works for the first mimetype it is run for.  That is why I have reached out the community for any advice on what may be happening.  For a rendition config you just specify the target mimetype, there is no config for supported source mimetypes for a rendition.  From what I gather from the documentation the transformation service does its own analysis of whether the source mimetype will be supported by the rendition being requested.  I have used the admin tool to determine if the source to target that is failing is supported (image magic png to png and jpg to png transforms both work from the tool).  From a transformation service perspective there is no issue.  Its only the rendition service that is failing because it says it does not support the requested rendition for the mimetype.    

Therefore, appart from defining the rendition file with the custom rendition, is there anything else I need to do?

Hopefully someone can shed some light on any changes I need (see my config in post above) or how I can troubleshoot why is is not finding a rendition for both png and jpg.

Regards

Brian