Search code examples
thumbnailsalfrescoopencmis

From CMIS how do I get the thumbnail placeholder for Alfresco?


I understand that the following URL will give me the thumbnail of a document or the placeholder image, if there isn't a thumbnail. This works because of the ph=true at the end.

http://cms.mydomain.com:8080/share/proxy/alfresco/api/node/workspace/SpacesStore/" + childId + "/content/thumbnails/doclib?ph=true

I have also found that the following server side code will get me the ContentStream of the thumbnail image.

    OperationContext context = session.createOperationContext();
    context.setRenditionFilterString("cmis:thumbnail");
    CmisObject doc = session.getObject(id, context);
    List<Rendition> renditions = doc.getRenditions();
    if (renditions.size() > 0) {
        Rendition rend = renditions.get(0);
        cs = rend.getContentStream();
    }

The problem with this is it does not return the placeholder image if there isn't a thumbnail, like the first URL.

For the server side how would I retrieve the appropriate placeholder image when there isn't a thumbnail? For example for docx and xlsx files.

Thanks, Jon


Solution

  • I think in this case the most effective way to retrieve thumbnails (doclib or a placeholder) is to call directly the REST Alfresco Service.

    I'm not 100% sure but CMIS rendition response from an Alfresco Server contains only existing renditions. There's no placeholder provided in CMIS renditions part like the one provided by the Alfresco REST url.