Skip to content Skip to sidebar Skip to footer

Facebook Js Api - Html5 Canvas Upload As A Photo

Is there a way to convert an HTML5 canvas to a some sort of an image format so that it can be uploaded to facebook users application album though the js api, I'm currently successf

Solution 1:

Yes, there is way to convert HTML5 Canvas to an image. Following javascript function on the Canvas JS element will do this:

toDataURL('image/jpeg', 1.0);

You can have PNG also.

This function will generate a Base64 representation of the canvas image. I am not sure if you can directly give a Base64 string to the Facebook API.

If you can, then it will be great, otherwise you need to save it temporarily on the server and give that URL to the FB API.

Post a Comment for "Facebook Js Api - Html5 Canvas Upload As A Photo"