在 Alfresco 4.0.d 中生成缩略图 [英] generating thumbnails in Alfresco 4.0.d

查看:26
本文介绍了在 Alfresco 4.0.d 中生成缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Alfresco Community 4.0.d 中的 Java Web 服务,目前希望向我的网站添加缩略图功能.我注意到在发布新图像后无法立即使用缩略图;我想知道是否有人可以推荐一种手动触发生成的好方法?

I am using the Java web services in Alfresco Community 4.0.d and currently looking to add thumbnail functionality to my site. I noticed the thumbnails are not available immediately after posting a new image; I was wondering if someone can recommend a good approach to have the generation triggered manually?

推荐答案

也在论坛中回答了您的问题.使用 JavaScript API,您可以要求文档生成其缩略图,如下所示:

Answered your question in the forums as well. Using the JavaScript API you can ask a document to generate its thumbnail, like this:

document.createThumbnail("doclib");

在这种情况下,doclib"是共享中文档库缩略图的缩略图配置名称,但这可以是您创建的任何缩略图定义.

In this case, "doclib" is the name of the thumbnail configuration for the document library thumbnails in Share, but this could be any thumbnail definition you've created.

文档位于 http://docs.alfresco.com/4.0/topic/com.alfresco.enterprise.doc/references/API-JS-Thumbnail-createThumbnail.html

对于 Java,请查看 org.alfresco.repo.thumbnail.CreateThumbnailActionExecuter 类源.在你自己的课堂上,你可以做类似的事情.或者,更好的是,使用 actionService 来调用创建缩略图操作.

For Java, look at the org.alfresco.repo.thumbnail.CreateThumbnailActionExecuter class source. In your own class you could do something similar. Or, better yet, use the actionService to invoke the create-thumbnail action.

要使用操作服务,您只需要操作的名称和它期望的参数.例如,当您使用邮件操作时,如下所示:

To use the Action Service, all you need is the name of the action and the parameters it expects. For example, here's what it looks like when you use the mail action:

ActionService actionService = getServiceRegistry().getActionService();
Action mailAction = actionService.createAction(MailActionExecuter.NAME);
mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, ExternalReviewNotification.SUBJECT);        
mailAction.setParameterValue(MailActionExecuter.PARAM_TO, recipient);
mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, ExternalReviewNotification.FROM_ADDRESS);
mailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, sb.toString());

actionService.executeAction(mailAction, null);

要对缩略图执行此操作,您将使用create-thumbnail"作为名称(或 CreateThumbnailActionExecuter.NAME).查看该类的源代码,我看到它需要两个参数,PARAM_CONTENT_PROPERTY,它是cm:content",和 PARAM_THUMBNAIL_NAME,它是普通文档库缩略图或缩略图名称的doclib"(如果你已经定义了你的缩略图名称)自己的.

To do this for thumbnails, you'll use "create-thumbnail" for the name (or CreateThumbnailActionExecuter.NAME). Looking at the source for that class I see that it takes two parameters, PARAM_CONTENT_PROPERTY, which would be "cm:content", and PARAM_THUMBNAIL_NAME which would be "doclib" for the normal document library thumbnail or your thumbnail name if you've defined your own.

需要注意的一点是,在 executeAction 调用中,第二个参数是对 noderef 进行操作".在您的情况下,您希望它成为您为其生成缩略图的节点.

One thing to note, in the executeAction call, that second argument is the "actioned upon noderef". In your case, you'll want that to be the node you are generating the thumbnail for.

这篇关于在 Alfresco 4.0.d 中生成缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆