Skip to content

Instantly share code, notes, and snippets.

@yonestra
Created December 24, 2011 18:10
Show Gist options
  • Save yonestra/1517969 to your computer and use it in GitHub Desktop.
Save yonestra/1517969 to your computer and use it in GitHub Desktop.
PhotoGalleryの写真を新規ファイルとしてアプリ内に保存する ref: http://qiita.com/items/1442
Titanium.Media.openPhotoGallery({
success: function(event) {
// アプリケーションデータディレクトリに出力する。
var f = Ti.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory + "/" + 'name.png');
if (!f.exists()) {
f.createFile();
}
f.write(event.media);
},
error: function(error) {
// notify(e.message);
},
cancel: function() {
// キャンセル時の挙動
},
// 撮影データのフォトギャラリーへの保存
saveToPhotoGallery:true,
// 選択直後に拡大縮小移動をするか否かのフラグ
allowEditing: true,
// 選択可能なメディア種別を配列で指定
mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment