Titanium Mobile MediaPicker Widget for iOS and Android
Developed as a widget for easy use with TiMediaPicker.
- Multiple selections are possible.
- Fastscroll support for large galleries.
- UI is completely develop of Titanium Alloy.
var MediaPicker = Alloy.createWidget('com.gimdongwoo.mediaPicker');
function callback(items) {
var photoInfos = [];
var iterate = function iterate(item) {
var _name = item.url.substring(item.url.lastIndexOf('/') + 1);
if (_name.indexOf('?') > -1) _name = _name.substring(0, _name.indexOf('?'));
MediaPicker.getImageByURL({
key: item.url,
id: item.id,
success: function success(e) {
photoInfos.push({
url: item.url,
id: item.id,
name: _name,
blob: e.image.apiName === 'Ti.Blob' ? e.image : null,
file: e.image.apiName === 'Ti.Blob' ? null : 'file://' + e.image,
width: e.width,
height: e.height
});
if (items.length) iterate(items.splice(0, 1)[0]);
else {
// END
Ti.API.info('success', photoInfos);
}
}
});
};
if (items.length) iterate(items.splice(0, 1)[0]);
}
MediaPicker.show({
callback: callback,
// The following are optional
max: 10,
type: 'photos', // or 'videos'
titleDone: 'Done',
maxAlertMsg: 'maximum number of images selected!'
});
-
Download release from this repository.
-
Copy
widget
andmodules
to your project (modules
need to unzip). -
Copy
themify.ttf
fromfont
toapp/assets/fonts
-
Add the widget as a dependency to your
app/config.json
file:"dependencies": { "com.gimdongwoo.mediaPicker": "1.0.0" }
-
Add the module as a modules to your
tiapp.xml
file:<modules> <module platform="iphone">ti.mediapicker</module> <module platform="android">ti.mediapicker</module> <module platform="iphone">av.imageview</module> <module platform="android">av.imageview</module> </modules>
- max image selection limit's alert message bug fix
ImageView
is chnaged toav.imageview
- Refactoring for Samsung Galaxy (autorotate bug)
- Initial Release