Skip to content

Instantly share code, notes, and snippets.

@artanisdesign
Forked from ricardoalcocer/instagram.js
Created July 31, 2014 08:57
Show Gist options
  • Save artanisdesign/ee42a395a6e7418000d8 to your computer and use it in GitHub Desktop.
Save artanisdesign/ee42a395a6e7418000d8 to your computer and use it in GitHub Desktop.
function showgallery(){
Titanium.Media.openPhotoGallery({
success:function(event){
var cropRect = event.cropRect;
var image = event.media;
Ti.API.debug('Our type was: '+event.mediaType);
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO){
var uri = image.nativePath;
var igIntent = Ti.Android.createIntent({
action:Ti.Android.ACTION_SEND,
packageName:"com.instagram.android",
type:"image/*"
});
igIntent.putExtraUri(Titanium.Android.EXTRA_STREAM, uri);
setTimeout(function(){
Ti.Android.currentActivity.startActivity(igIntent);
}, 400);
}else{
// is this necessary?
}
Titanium.API.info('PHOTO GALLERY SUCCESS cropRect.x ' + cropRect.x + ' cropRect.y ' + cropRect.y + ' cropRect.height ' + cropRect.height + ' cropRect.width ' + cropRect.width);
},
cancel:function(){
},
error:function(error){
},
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