Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

New Developer
Posts: 31
Registered: ‎04-21-2011
My Device: Playbook
My Carrier: N/A
Accepted Solution

Invoke Facebook with base64 image + text



I'm trying to share an image (from the screenshot extension) to Facebook without writing it to disk. I would also like to be able to include text and a photo in the invoke call. Unfortunately, while I have a valid base64 image (renders properly with 'window.open', and I can invoke facebook with text only, I am unable to invoke with the base64 image. Any pointers would be greatly appreciated!


function ss() {
	var options = {dest:'data:', mime:'image/png'};
	var screenshot = community.screenshot.execute(options);
	// check result
	if(screenshot.substr(0,5)=="data:") {

		// Pixastic assumes the image is in an img tag
		var oImg=document.createElement("img");
		oImg.setAttribute('src', screenshot);
		// crop the image
		Pixastic.process(oImg, "crop", { rect : { left : 0, top : 0, width : 100, height : 100 } }, function (oCanvas){ 
			// this works perfectly, so the image is good:
			// window.open(oCanvas.toDataURL()); 

				// this works, so invoke permissions must be right:
			        target: "Facebook",
			        action: "bb.action.SHARE",
			        type: "text/plain",
			        data: "some text"
			    }, function() {console.log("FB SUCCESS!");}, function() {console.log("FB ERROR!");});
				// no amount of munging with this will work (e.g., using 'data' instead of uri):
			        target: "Facebook",
			        action: "bb.action.SHARE",
			        type: "image/png",
			        uri: oCanvas.toDataURL()
			    }, function() {console.log("FB SUCCESS!");}, function() {console.log("FB ERROR!");});




Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Invoke Facebook with base64 image + text

I am told that Facebook filters only look at files.


If you write to the /tmp directory, it is backed by RAM, so that should alleviate most performance concerns.

Tim Windsor
Open Source Technical Lead