Probeer dit te doen:
De afbeelding opslaan in Node
ImageController.create({image: new Buffer(req.body.image, "base64")},
function(err, img) {
if(err) { return handleError(res, err); }
return res.status(201).json(img);
}
);
Laden en decoderen in Node
ImageController.findById(req.params.id, function (err, img) {
if(err) { return handleError(res, err); }
if(!foto) { return res.send(404); }
return res.json(img.toString('base64'));
});
Hoekcontroller
$http.get('/api/images/'+$scope.image._id).
then(function (response) {
$scope.imgSrc = response.data;
}, function (response) {
});
Hoekweergave
<img ng-src="data:image/jpg;base64,{{imgSrc}}">