从 CMIS 如何获取 Alfresco 的缩略图占位符?

问题描述:

我知道,如果没有缩略图,以下 URL 将为我提供文档的缩略图或占位符图像.这是因为最后的 ph=true 有效.

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

我还发现以下服务器端代码会为我获取缩略图的 ContentStream.

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();
    }

问题在于,如果没有缩略图(如第一个 URL),它不会返回占位符图像.

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

对于服务器端,如果没有缩略图,我将如何检索适当的占位符图像?例如 docx 和 xlsx 文件.

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.

谢谢,乔恩

我认为在这种情况下,检索缩略图(doclib 或占位符)的最有效方法是直接调用 REST Alfresco 服务.

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

我不是 100% 肯定,但来自 Alfresco 服务器的 CMIS 再现响应仅包含现有再现.CMIS 再现部分中没有像 Alfresco REST url 提供的占位符那样提供占位符.

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.