Hi,
I am trying to covert data of an image to base64 encoding, and the image
itself is downloaded using http.get.
For some reason, base64.encode(image_data) returns invalid data. I tried
all the following, but no luck:
image_data = downloadFileFromUrl(URL); // the function is defined below
$scope.img = 'data:image/jpg;base64,' + $base64.encode(image_data);
$scope.img = 'data:image/jpg;base64,' + btoa(image_data);
$scope.img = 'data:image/jpg;base64,' +
btoa(unescape(encodeURIComponent(image_data)));
In html, we have
<img ng-src="{{img}}"/>
Download function is:
downloadFileFromUrl = function(url) {
return $http.get(url).then(function(results) {
return results.data;
}
Any help is appreciated!
Thank!
Manju
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.