java - Convert image data InputStream to string and from this string back to image does not gives the image -


cq5 image component has binary image data, require data exposed in api.

to tried input stream , read string.

inputstream = jcrnode.getproperty(jcrconstants.jcr_data).getbinary().getstream();  string imagedata = jcrnode.getproperty(jcrconstants.jcr_data).getstring(); 

when trying write string fileoutputstream dont image.

while trying download jcr:data manually , open file image viewer gives image. when converting string , doesn't work me. suggestions on this.

thanks @i.net able solve per ur suggestions above.

stringbuilder datauri = new stringbuilder(); datauri.append("data:image/jpeg;base64"); datauri.append(stringutils.newstring utf8(base64.encodebase64(imagebytearray,false)));

datauri.tostring() string can used embedded reference images.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -