本文整理汇总了TypeScript中ionic-native.ImagePicker类的典型用法代码示例。如果您正苦于以下问题:TypeScript ImagePicker类的具体用法?TypeScript ImagePicker怎么用?TypeScript ImagePicker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImagePicker类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(public nav: NavController) {
this.options = {
// max images to be selected, defaults to 15. If this is set to 1, upon
// selection of a single image, the plugin will return it.
maximumImagesCount: 15,
// max width and height to allow the images to be. Will keep aspect
// ratio no matter what. So if both are 800, the returned image
// will be at most 800 pixels wide and 800 pixels tall. If the width is
// 800 and height 0 the image will be 800 pixels wide if the source
// is at least that wide.
width: 1024,
height: 1024,
// quality of resized image, defaults to 100
quality: 100
};
ImagePicker.getPictures(this.options).then((results) => {
this.images=results;
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
}
}, (err) => {
});
}
示例2: uploadImage
//用户上传头像
uploadImage(){
var opt = { maxImagesCount:1, width:100, height:100, quality:50 };
ImagePicker.getPictures(opt).then((results) => {
for (var i = 0; i < results.length; i++) {
//console.log('Image URI: ' + results[i]);
console.log('Image URI: ' + results[i]);
//将图片上传到服务器,调用 API
}
}, (err) => { }) ;
}
示例3: doImagePicker
doImagePicker(){
var options:ImagePickerOptions = {
}
ImagePicker.getPictures(options).then((results) => {
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
}
}, (err) => {
console.log(err);
});
}
示例4: getImages
getImages() {
let options = {
width: 100,
height: 100,
quality: 100
};
ImagePicker.getPictures(options).then(results => {
this.images = results;
}, (err) => {
});
}
示例5: openGallery
private openGallery (): void {
let options = {
maximumImagesCount: 8,
width: 500,
height: 500,
quality: 75
}
ImagePicker.getPictures(options).then(
file_uris => this._navCtrl.push(GalleryPage, {images: file_uris}),
err => console.log('uh oh')
);
}
示例6: imagePicker
imagePicker() {
var options = {
maximumImagesCount: 10,
width: 800,
height: 800,
quality: 80
};
ImagePicker.getPictures(options).then((results) => {
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
}
}, (err) => {
});
}