Storing images in couchbase

Hi,

Can any one suggest how can I store user specific images(base64) using couch base server.

My server component is node js server. Clients send images to node js using rest api and intern I need to store those images in to couch base.

What should my approach to store images linked to particular couch base document.

Regards,
Srikar

Perhaps this post by @nraboy may help Storing Base64 Files Directly in Couchbase via Node.js - The Couchbase Blog .
W.r.t. modeling your data, with pre-encoded base64 images, you could (a) store the images as JSON values within your document itself or (b) maybe store them as separate JSON documents referenced by the parent document. @nraboy may be able to offer other ideas.
As a side, the decision on whether you store the images directly in the Database or in a separate file system is a choice you would have to make depending on your application needs (image sizes, storage cost, replication).

Also note © - store as binary objects - most of the SDKs support the ability to store with a custom transcoder if your data isn’t JSON.

You could store as binary or as base64, but if I were to do it myself, I’d use object storage and reference the images in the database.

1 Like