This module uses the Matisse SDK on Android and YPImagePicker on iOS.
This started as a parity effort via @prashantsaini1/titanium-imagepicker but as we decided to use different libraries than before (lately by using Matisse instead of an own library).
- Android: Titanium 7.0.0+
- iOS: Titanium 8.0.0+
<module platform="android">ti.imagepicker</module>
<module platform="iphone">ti.imagepicker</module>
- Opens the inbuilt gallery with a 3x3 default grid-view.
- Takes following arguments in a single dictionary object. (All arguments are optional though)
| Argument | Description | Default Value | Platform |
|---|---|---|---|
| String doneButtonTitle | Title of the OK button which calls the callback method | Done | Android, iOS |
| String nextButtonTitle | Title of the "Next" button | Next | iOS |
| String cancelButtonTitle | Title of the "Cancel" button | Cancel | iOS |
| String cameraTitle | Title of the "Photo" button | Photo | iOS |
| String libraryTitle | Title of the "Library" button | Library | iOS |
| String albumsTitle | Title of the "Albums" button | Albums | iOS |
| Bool forceSquare | Force images to be squRE | false |
iOS |
| int columnCount | Number of grid-view columns to show in gallery | 3 (2 to 5 on Android, no limit on iOS) | , iOS |
| int maxImageSelection | Maximum number of images to select. Can be used for single image selection by passing as 1 | No limit | Android |
| function callback | Callback method to get results into. See below example for its usage | none | Android, iOS |
import ImagePicker from 'ti.imagepicker';
ImagePicker.openGallery({
callback : function (e) {
if (e.success) {
var allImages = e.images;
} else if (e.cancel) {
// gallery result cancelled
} else {
alert(e.message);
}
}
});MIT