Posting Image Event on javascript facebook api -


OK, I'm stuck, I want to create an event in Facebook using the Javascript Facebook API, Loading is the image on the event cover. I can not understand how I can do it.

I am creating an image in a canvas and I can upload it using the asbinary function on Facebook: and this function

  Facebook.prototype.postImageToFacebook = function (AuthToken, filename, mimeType, imageData, message) {showmoase ("Creating post ..."); // This is multipart / form-data limit, we will use the range of var I == ---------- RaNdOm_crAPP '+ getBoundary (); // Let us encode our image file, which is contained in Var var formadata = '-' + + + + '\ r \ n'; FormData + = 'Content-Disposal: Form-Data; Name = "source"; File name = "'+ filename +'" \ r \ n '; FormData + = 'Content-Type:' + mimeType + '\ r \ n \ r \ n'; FormData + = String.fromCharCode (imageData [i] & amp; 0xff);} FormData + = '\ r \ n'; FormData for (Var i = 0; i & lt; imageData.length; ++ i) + = '-' + Border + '\ r \ n'; FormData + = 'Content-Disposal: Form-Data; Name = "Message" \ r \ n \ r \ n'; FormData + = Message + '\ r \ N '; FormData +' '-' + border + '- \ r \ n'; // var xhr = new XMLHttpRequest (); var xhr = null; if (window.XDomainRequest) {xhr = New XDomainRequest (); } And {(window.XMLHttpRequest) {xhr = New XMLHttpRequest ();} and {xhr = New ActiveXObject ("Microsoft.XMLHTTP");} Xhr.onload = function () {window.alert ("The photo was successfully published Was !! ");} ShowMessage (" Sending Request ... "); Xhr.open (" Post "," https://graph.facebook.com/me/photos?acce Ss_token = "+ authToken, true;); (xhr.setRequestHeader) xhr.setRequestHeader (" content-type "," multicast / form-data; limit = "+ range); xhr.sendAsBinary (formData); ) {StopWaitingSpin (); debugLog (former);}}  

and with it

  FB.api ("/ me / events", " Description, "location": location, // "location_id": location_id, "privacy_type": privacy_type} "post", "name": name, "start_time": start_time, // "end_time": end_time, "description" , Function (reaction) {if (feedback & amp; reaction. Terror) {var event_id = response.id; Console.log (feedback);}});  

I can make an event.

But what is the need to call to send the image to cover the incident?

Thank you really so far has not yet been mentioned in the documentation, but you need to publish a cover photo on an event that you need. To call \ POST / {event-id} with the absolute cover_url :

{event-id} As a result when you create an event.

  FB.api ("/ {event-id}", "POST", {cover_url: {image-url}}, function (feedback) {Console.log (response); / / You will get feedback as 'true' or 'false';);  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -