Closed lpatiny closed 7 years ago
I always send credentials, it should work on private views
You are right. In fact it is when I load the image using image-js. I just used the URL so I don't know what should I do.
With couchdb attachment you can get the data content as a Blob by doing
cdb.get(attachmentName, {responseType: 'blob'})
You can then convert the Blob to a dataUrl before passing it to image-js
function blobToDataURL(blob, callback) {
var a = new FileReader();
a.onload = function(e) {callback(e.target.result);}
a.readAsDataURL(blob);
}
Not an easy solution ... how we could forward credential ? Can it be in the url somehow ?
You have two options:
{responseType: 'arraybuffer'}
) and then pass it to Image.load{withCredentials: true}
to the Image.load optionsOk, didn't know withCredentials
was an option in image-js
I don't know how to send credential so that couch attachments can load attachment of a non public view