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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -