cancel
Showing results for 
Search instead for 
Did you mean: 

Creating and Retrieving thumbnails for documents

arpit_gupta
Champ in-the-making
Champ in-the-making
Hello Friends,

I want to create thumbnails for new documents uploaded in alfresco.
I am uploading documents using web scripts. I have added code for creating thumbnails in my upload script.

Some code from script…


  upload = companyhome.createFile("upload" + companyhome.children.length + "_" + filename) ;
  upload.properties.content.write(content);
  upload.properties.content.mimetype = "UTF-8";
  upload.properties.title = title;
  upload.specializeType("propco:documents");
  upload.properties.description = description;
  upload.save();
  upload.createThumbnail("thumbnailPreview", true);


Now when i try to access thumbnail using a GET call
http://127.0.0.1:9090/alfresco/service/api/node/workspace/SpacesStore/c01183a5-a120-45a4-8882-9f3637...

i got an exception that  " The thumbnail name 'thumbnailPreview' is not registered ".

I am sure i am missing something. But i am unable to figure it out.
So can someone please help me in this…

Thanks,
Arpit
3 REPLIES 3

jpfi
Champ in-the-making
Champ in-the-making
Hi,
it should be "doclib" (jpg thumbnail) & "webpreview" for the flash preview:
upload.createThumbnail("doclib", true);
upload.createThumbnail("webpreview", true);
cheers, jan

arpit_gupta
Champ in-the-making
Champ in-the-making
Thanks jan….

I found the problem i need to register thumbnail's definition in thumbnail-service-context.xml.
and yes i can also do as you propose as "doclib" and "webpreview" are predefined thumbnails.

jpfi
Champ in-the-making
Champ in-the-making
Hi,
yub, you're right..you didn't mentioned that you#re trying to use a custom thumbnail definition. 🙂
cheers, jan