Android版添加phonegap--imagePicker插件教程
2015-12-29 10:42
435 查看
一、Cordova-imagePicker的介绍:
Cordova插件实现多图像选择,支持IOS和Android4及以上。
二、安装插件:
插件符合Cordova规范,也可以使用Phonegap/Cordova命令行界面安装。
phonegap plugin add https://github.com/wymsee/cordova-imagePicker.git
cordova plugin add https://github.com/wymsee/cordova-imagePicker.git
三、使用插件:
该插件创建的对象方法window.imagePicker.getPictures(成功、失败、选项)
例如:获得全尺寸图片(默认选项)
window.imagePicker.getPictures(
function(results) {
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
}
}, function (error) {
console.log('Error: ' + error);
}
);
例如:得到10幅画的宽度为800
window.imagePicker.getPictures(
function(results) {
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
}
}, function (error) {
console.log('Error: ' + error);
}, {
maximumImagesCount: 10,
width: 800
}
);
四、选项
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: int,
//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: int,
height: int,
//quality of resized image, defaults to 100
quality: int (0-100)
};
五、安卓使用说明
插件返回的图像,存储在一个临时目录中。这些图像通常不会被自动删除。文件应该被删除或移动你的JavaScript文件。
Android这个插件使用的是MultiImageChooser修改,MultiImageChooser采用了BSD 2-Clause许可证文件中可以找到bsd_license。一些代码里面MultiImageChooser也有Apache许可证可以在文件下找到Apache_license。
imagePicker插件Demo:https://github.com/wymsee/cordova-imagePicker
KeyMob移动广告平台是中国专业的移动广告 、移动广告优化平台,为企业客户和应用开发者提供最优的技术服务, 创造最佳收入。
Cordova插件实现多图像选择,支持IOS和Android4及以上。
二、安装插件:
插件符合Cordova规范,也可以使用Phonegap/Cordova命令行界面安装。
phonegap plugin add https://github.com/wymsee/cordova-imagePicker.git
cordova plugin add https://github.com/wymsee/cordova-imagePicker.git
三、使用插件:
该插件创建的对象方法window.imagePicker.getPictures(成功、失败、选项)
例如:获得全尺寸图片(默认选项)
window.imagePicker.getPictures(
function(results) {
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
}
}, function (error) {
console.log('Error: ' + error);
}
);
例如:得到10幅画的宽度为800
window.imagePicker.getPictures(
function(results) {
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
}
}, function (error) {
console.log('Error: ' + error);
}, {
maximumImagesCount: 10,
width: 800
}
);
四、选项
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: int,
//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: int,
height: int,
//quality of resized image, defaults to 100
quality: int (0-100)
};
五、安卓使用说明
插件返回的图像,存储在一个临时目录中。这些图像通常不会被自动删除。文件应该被删除或移动你的JavaScript文件。
Android这个插件使用的是MultiImageChooser修改,MultiImageChooser采用了BSD 2-Clause许可证文件中可以找到bsd_license。一些代码里面MultiImageChooser也有Apache许可证可以在文件下找到Apache_license。
imagePicker插件Demo:https://github.com/wymsee/cordova-imagePicker
KeyMob移动广告平台是中国专业的移动广告 、移动广告优化平台,为企业客户和应用开发者提供最优的技术服务, 创造最佳收入。
相关文章推荐
- Android 快速开发系列 ORMLite 框架最佳实践
- Android 自定义Animation动画
- android Toast、Looper、Handler消息循环机制
- Android遇到的问题总结
- Android调试时每次弹出Android Device Chooser窗口
- Android 使用NineOldAndroids实现绚丽的ListView左右滑动删除Item效果
- android中修改tablayout中的字体大小和颜色
- Android-Text and Input
- Android界面设计视觉规范(转)
- Android开发总结笔记 Btimap (下) 3-5
- android 开发问题汇总持续
- Android 下获取所有应用的流量使用量
- 报错:Binary XML file line #7: Error inflating class android.support.v7.widget.RecyclerView
- Android代码里判断语言和横竖屏
- Android动态渐变view的颜色
- Android中以JAR形式封装控件或者类库
- Android屏幕适配
- Android:获取状态栏高度
- android 跑马灯效果
- 学习Android之路