Page 1 of 1
Document thumbnails
PostPosted:Thu Jun 08, 2017 3:02 pm
by greengold
I am trying to get document thumbnail out of openKm, but I'm failing to find any reference guide to this process.
SDK says:
Code: Select allpublic InputStream getThumbnail(String docId, ThumbnailType type) throws PathNotFoundException, AccessDeniedException,
ConversionException, AutomationException, RepositoryException, DatabaseException, IOException, UnknowException,
WebserviceException;
so can you tell me waht is the meaning of each of three "ThumbnailType"s and in which format does the thumbnail come out?
Thanks!
Re: Document thumbnails
PostPosted:Sun Jun 11, 2017 7:48 am
by jllort
There's a thumbnail in properties ( small one ) another in search view ( small one ) and when you click on a thumbnail is shown a big one ( full screen ), these are the three types.
Re: Document thumbnails
PostPosted:Mon Jun 12, 2017 5:03 pm
by greengold
thanks!
and what is the format of data that this outputs? I am saving this stream as png or jpg but viewer fails to open it as image
Re: Document thumbnails
PostPosted:Wed Jun 14, 2017 6:37 pm
by jllort
Should be a png. If you capture with firebug or similar the download url of the thumnail and you paste in the browser ( save and you'll see a png ). What are you doing with the input stream, might be the stream is closed before finishing to save the document. Share the piece of code what is doing it and we'll take a look.
Re: Document thumbnails
PostPosted:Thu Jun 15, 2017 10:33 am
by greengold
so here's what I do:
https://stackoverflow.com/questions/445 ... n-angular4
I have composed it as SO thread because I have rather extensive process and I'm not sure in which part it goes wrong.
However I was even unsuccessfull to save an image as .png after receiving it from java service (as you can read process in the post) and view it.
Doubt streams are closed too early.
Can you check on your side, please?
Thanks!
Re: Document thumbnails
PostPosted:Sat Jun 17, 2017 9:03 am
by jllort
I think the problem is not the stream is closed early, the problem I think will be in the way is downloaded, take a look here:
https://docs.openkm.com/kcenter/view/sd ... getContent
From the server side ( inde middle between OpenKM and your user interface ) the problem usualy is:
Code: Select all//response.setContentLength(is.available()); // Cause a bug, because at this point InputStream still has not its real size.
And you should use
Code: Select allresponse.setContentLength(new Long(doc.getActualVersion().getSize()).intValue());
Re: Document thumbnails
PostPosted:Mon Jul 03, 2017 10:12 am
by greengold
ok resolved. OKM is fine. The problem was with piping nodeJs response to the angular FE:
Code: Select alllet reply = request(options);
reply.pipe(res);