...
Code Block | ||
---|---|---|
| ||
var buf = a.buffers; var val = a.vals; var item; if ( a.type == 'thumbnailPhoto' ) item = buf; else item = val; if (item && item.length) { if (item.length > 1) { obj[a.type] = item.slice(); } else { obj[a.type] = item[0]; } } else { obj[a.type] = []; } |
Then, overwrite the thumbnailPhoto attribute to be a string used in <img src='{thumbnailPhoto}'>:
Code Block | ||
---|---|---|
| ||
router.post('/login',
passport.authenticate('ldapauth'),
(req, res) => {
req.user.thumbnailPhoto = 'data:image/jpeg;base64,' + Buffer.from(req.user.thumbnailPhoto).toString('base64');
res.render('profile', req.user);
}); |
Related articles
https://github.com/joyent/node-ldapjs/issues/137
...