本文整理匯總了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) => {
});
}