Skip to content

gimdongwoo/ti-media-picker-widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ti-media-picker-widget

Titanium Mobile MediaPicker Widget for iOS and Android

Developed as a widget for easy use with TiMediaPicker.

Features

  • Multiple selections are possible.
  • Fastscroll support for large galleries.
  • UI is completely develop of Titanium Alloy.

ScreenShot

Demo Video

https://youtu.be/F1bCNAG0iYw

How to use

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!'
});

Quick Start

  1. Download release from this repository.

  2. Copy widget and modules to your project (modules need to unzip).

  3. Copy themify.ttf from font to app/assets/fonts

  4. Add the widget as a dependency to your app/config.json file:

    "dependencies": {
      "com.gimdongwoo.mediaPicker": "1.0.0"
    }
    
    
  5. 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>
    

Reference

  1. TiMediaPicker Module
  2. Themify Icon Font

Changelog

Version 1.1.1

  • max image selection limit's alert message bug fix

Version 1.1.0

  • ImageView is chnaged to av.imageview
  • Refactoring for Samsung Galaxy (autorotate bug)

Version 1.0.0

  • Initial Release

About

Media Picker Widget (Image and Video) for Titanium Mobile

Resources

License

Stars

Watchers

Forks

Packages

No packages published