How do you include a picture in Titanium's Facebook Module dialog? In Titanium's example, the picture property in the dialog is a link of a picture from a website:
var data = { link : "http://www.appcelerator.com", name : "Appcelerator Titanium Mobile", message : "Checkout this cool open source project for creating mobile apps", caption : "Appcelerator Titanium Mobile", picture : "http://developer.appcelerator.com/assets/img/DEV_titmobile_image.png", description : "You've got the ideas, now you've got the power. Titanium translates " + "your hard won web skills into native applications..." }; fb.dialog("feed", data, function(e) { if(e.success && e.result) { alert("Success! New Post ID: " + e.result); } else { if(e.error) { alert(e.error); } else { alert("User canceled dialog."); } } });But what if you want to use a picture that's local and NOT via a link of a website like this?
var data = { link: "http://play.google.com/", name: "Android app's name", picture: "file:///data/data/com.appid/app_appdata/directory/name-of-image.jpg" };I get the picture property formatting error if I use the code above. See this image for visual reference: http://postimg.org/image/wjefdlalb/
I've tried using the FileSystem like this:
function getFile() { var imageFileToPost; var imageFile = Ti.Filesystem.getFile("file:///data/data/com.appid/app_appdata/directory/name-of-image.jpg"); if (imageFile.exists()) { console.log("exists"); imageFileToPost = imageFile.read(); } return imageFileToPost; } var data = { link: "http://play.google.com/", name: "Android app's name", picture: getFile() };And the post is successful, there are no errors BUT the picture was NOT published on Facebook.
Note: I would use the graph but I need to use permissions like 'publish_actions' which means I have to to have Facebook review the app but they don't like prefill messages even when the user can edit message anyways.
So is this really just a formatting issue with Facebook Module's dialog or it only takes URLs of a picture? If it's a formatting issue, can anyone tell me how to format this correctly because I really need to use the picture that's local and not from a website?