Android版添加phonegap--imagePicker插件教程

一、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移动广告平台是中国专业的移动广告 、移动广告优化平台,为企业客户和应用开发者提供最优的技术服务, 创造最佳收入。








  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值