mirror of
https://gitee.com/shuto/cordova-imagePicker.git
synced 2026-05-23 00:05:03 +08:00
updated readme with output type example
This commit is contained in:
@@ -20,29 +20,29 @@ The plugin creates the object `window.imagePicker` with the method `getPictures(
|
||||
Example - Get Full Size Images (all default options):
|
||||
```javascript
|
||||
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);
|
||||
}
|
||||
function(results) {
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
console.log('Image URI: ' + results[i]);
|
||||
}
|
||||
}, function (error) {
|
||||
console.log('Error: ' + error);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
Example - Get at most 10 images scaled to width of 800:
|
||||
```javascript
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
@@ -50,24 +50,30 @@ window.imagePicker.getPictures(
|
||||
|
||||
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)
|
||||
// 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),
|
||||
|
||||
// output type, defaults to FILE_URIs.
|
||||
// available options are
|
||||
// window.imagePicker.OutputType.FILE_URI (0) or
|
||||
// window.imagePicker.OutputType.BASE64_STRING (1)
|
||||
outputType: int
|
||||
};
|
||||
|
||||
### Note for Android Use
|
||||
|
||||
The plugin returns images that are stored in a temporary directory. These images will often not be deleted automatically though. The files should be moved or deleted after you get their filepaths in javascript.
|
||||
When outputType is FILE_URI the plugin returns images that are stored in a temporary directory. These images will often not be deleted automatically though. The files should be moved or deleted after you get their filepaths in javascript. If Base64 Strings are being returned, there is nothing to clean up.
|
||||
|
||||
## Libraries used
|
||||
|
||||
|
||||
Reference in New Issue
Block a user