cancel
Showing results for 
Search instead for 
Did you mean: 

Request for How-To: Thumbnail webscripts

jluzier
Champ in-the-making
Champ in-the-making
I've recently download the Alfresco 3.0 Enterprise to evaluate. I'm very much interested in taking advantage of the thumbnailing features I've read about. I'm referring to the scripts located in the /org/alfresco/repository/thumbnail package.

My use case is that I have a space containing images and would like to invoke a script(s) to create and view thumbnails. The goal would be the return of a URL that could be placed on a web page, RSS media feed, etc.

I found this:
http://wiki.alfresco.com/wiki/3.0_JavaScript_Services_API#Thumbnail_Services
but given my newness to Alfresco webscripting, I'm unable to put 2-2 together and structure a URL request to the script properly to see the 'magic' happen. This isn't enough detail for me to leverage.

Does anyone have a solid example how to implement the use case I describe above? I'm very interested in seeing how the request to the webscript would be structured that produces thumbnails for a given space.
4 REPLIES 4

mikeh
Star Contributor
Star Contributor
Your use case may be better suited to the REST API. http://wiki.alfresco.com/wiki/3.0_REST_API#Thumbnail_Service

In either case, you can browse through the Share source code to see how we utilise the Thumbnail service in the Document Library and elsewhere.

Mike

louise
Champ in-the-making
Champ in-the-making
Is this service available in 3.0b Labs version?

My test post (same effect with other methods):
htdump -post="{ \"thumbnailName\" : \"webpreview\"}" "http://admin:admin@127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/34042d8b-d127-43ac..."

And the answer (ReferenceError: \"json\" is not defined😞
org.alfresco.scripts.ScriptException: Failed to execute script '\/org\/alfresco\/repository\/thumbnail\/thumbnails.post.js (in classpath store file:\/opt\/alfresco\/tomcat\/webapps\/alfresco\/WEB-INF\/classes\/alfresco\/templates\/webscripts)': ReferenceError: \"json\" is not defined. (AlfrescoScript#17)

mikeh
Star Contributor
Star Contributor
You need to post the request as application/json

Mike

louise
Champ in-the-making
Champ in-the-making
Thanks Mike!

My request with new content type (Content-Type: application/json;charset=UTF-8😞
htdump -extra="Content-Type: application/json;charset=UTF-8" -post="{thumbnailName:medium}" "http://admin:admin@127.0.0.1:8080/alfresco/service/api/node/workspace/SpacesStore/34042d8b-d127-43ac..."

And the answer:

{
   "thumbnailName" : "medium",
   "url" : "\/alfresco\/service\/api\/node\/workspace\/SpacesStore\/34042d8b-d127-43ac-8d76-b833493e0c96\/content\/thumbnails\/medium"
}