Save image in couchbase lite java -
how save image in couchbase lite in core java? save image in couchase server, convert image bytes , save bytes. not having in couchbase lite. kindly me.
final bufferedimage image = imageio.read(new file(file.getpath())); bytearrayoutputstream baos = new bytearrayoutputstream(); imageio.write(image, "png", baos); document img_doc = db.getdocument("image"); map<string, object> img_properties = new hashmap<string, object>(); img_properties.put("image", bytes); img_doc.putproperties(img_properties);
any non-valid json type (like image example) can stored in couchbase lite binary attachment. attachment created using setattachment
on revision object. content of attachment stored in filesystem , revision keeps reference it. way, can attachment through document or revision object. see code example here.
Comments
Post a Comment