Reputation: 59
I've implemented nativescript image picker plugin in my Nativescript -Angular code but I'm trying to figure out how to resize image picked from nativescript-imagepicker that can display as Account or Profile picture in circle
Upvotes: 2
Views: 1459
Reputation: 21908
The selected
image will be instance of ImageAsset, you may set the options with desired width
and height
then call use fromAsset method on ImageSource for resized image.
context
.authorize()
.then(function() {
return context.present();
})
.then(function(selection) {
selection.forEach(function(selected) {
// Set values for width, height, keepAspectRatio (boolean)
selected.options = {width, height, keepAspectRatio };
imageSourceModule.fromAsset(selected)
.then((imageSource) => {
// imageSource is resized one
});
});
}).catch(function (e) {
// process error
});
Upvotes: 5