node-ldapjs icon indicating copy to clipboard operation
node-ldapjs copied to clipboard

Is possible to write the binary field jpegPhoto, adding a ldap entry?

Open augcampos opened this issue 8 years ago • 3 comments

I want to make a ldap add with a binary field how do I set it on the entry?

var entry = { uid: 'lalala', jpegPhoto: '{{ img content data in BASE64 }}' ldap_client.add(dn, entry,function (err) { ... });

this do not work :(

augcampos avatar Mar 16 '16 19:03 augcampos

I already try

var imgBase64 = '/9kljnfkjsdnf.......==';
.......
var userPhoto = new Buffer(imgBase64);
also try 
var userPhoto = new Buffer(imgBase64, 'base64');
also try 
var userPhoto = new Buffer(imgBase64, 'binary');
.....
var entry = { uid: 'lalala', jpegPhoto: userPhoto };
ldap_client.add(dn, entry,function (err) {
...
});

all did not work :(

PS: What I need is to add a new entry on ldap with the jpegPhoto filled with a image-src like <img ng-src="{{'data:image/png;base64,'+main.user.jpegPhoto}}"> from a LDAP jpegPhoto property

augcampos avatar Mar 17 '16 09:03 augcampos

@augcampos Have you found any solution ?

feraudet avatar Jun 21 '16 10:06 feraudet

@augcampos var userPhoto = new Buffer(imgBase64, 'base64'); would work fine with this PR: https://github.com/mcavage/node-ldapjs/pull/383

feraudet avatar Jun 21 '16 12:06 feraudet

👋

On February 22, 2023, we released version 3 of this library. As a result, we are closing this issue/pull request.

Please see issue #839 for more information, including how to proceed if you feel this closure is in error.

jsumners avatar Feb 22 '23 19:02 jsumners