jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bhavesh Bhanushali <b.r.bhanush...@gmail.com>
Subject Images problem in jackrabbit
Date Thu, 28 Oct 2010 13:50:57 GMT
Hi,

I am newbie in using jackrabbit, I am facing a strange issue when i am
storing and retrieving images from jackrabbit. The text in the images
fetched are garbled and size is reduced.

I apologize if i am sending to wrong mailing list. I tried to subscribe to
user's mailing list but it is throwing errors.

Meanwhile, here is the strange problem.

The image is stored into jackrabbit by using following piece of code

-----
 Node fileNode = contentNode.addNode(content.getFileName(),
NodeType.NT_FILE);
                                Node _fileContentNode =
fileNode.addNode(JcrConstants.JCR_CONTENT, NodeType.NT_RESOURCE);

 _fileContentNode.setProperty(JcrConstants.JCR_MIMETYPE,
content.getMimeType());

 _fileContentNode.setProperty(JcrConstants.JCR_DATA,
ValueFactoryImpl.getInstance().createBinary(new
ByteArrayInputStream(IOUtils.toByteArray(content.getFile().getInputStream()))));
                                 session.save();
-----

when i retrieve the image using the proper path, the image is fetched with
no problem but the text of the image is garbled and is not readable.

Please refer attachment, actual image uploaded is
"math_eq1_to_repository.png" and fetched image is
"math_eq1_from_repository.png"

Same thing happens with GIF and JPEG images.

I am not sure what is the wrong in the above code.

Request you all to help me to fix this strange issue.

Jackrabbit version used is 2.1.0

Thanks,
Bhavesh R Bhanushali

Mime
View raw message