Created
January 3, 2012 04:22
-
-
Save aaronksaunders/1553464 to your computer and use it in GitHub Desktop.
new twitter upload with birdhouse example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendTwitterImage(_callback, _params) { | |
var contents = null; | |
var IMAGE_NOT_FOUND = { | |
success : false, | |
message : "No image provided" | |
}; | |
// get the content | |
if(_params.image && ( typeof _params.image === "object")) { | |
contents = _params.image; | |
} else if(_params.image) { | |
var file = Ti.Filesystem.getFile(_params.image); | |
if(file.exists === false) { | |
return IMAGE_NOT_FOUND; | |
} | |
contents = file.read(); | |
} else { | |
return IMAGE_NOT_FOUND; | |
} | |
BH.sendTwitterImage({ | |
'status' : _params.status, | |
'media' : contents | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment