1

I would like for the user to share client side image on facebook with the feed dialog or other approach

FB.ui({ method: 'feed',
caption: 'Mega Tangram Picture',
message: 'I made this tangram picture on MegaTangram',
picture: canvas.toDataURL("image/png;base64;")
}, function(response){console.log(response);}); 

Its not working with the dataURL standard, is there another way to do this (graph api?), it must be possible to share dynamically created images that are not held on the server?

The error I got was:

An error occurred. Please try again later.

API Error Code: 100
API Error Description: Invalid parameter
Error Message: picture URL is not properly formatted

checkupdatefeed result parameter= undefined script.js:1183
checkupdatefeed result parameter= 1390679958266:9.4.0 

When trying with image/jpeg;base64, I get the following error:

Could not find callback 1
Rodrigo Medeiros
  • 7,814
  • 4
  • 43
  • 54
ejectamenta
  • 1,047
  • 17
  • 20
  • 2
    You can try this one https://coderwall.com/p/4qpmfw but I have never done something similar – dachi Jan 26 '14 at 17:44
  • @dachi it seems that this is for uploading images to the user photos, not for sharing on the feed. – Spone Jan 26 '14 at 18:38
  • that looks good however I am getting the following error when making the post as if facebook only allows these kind of posts from a php environment! { "error": { "message": "API calls from the server require an appsecret_proof argument", "type": "GraphMethodException", "code": 100 } } – ejectamenta Jan 26 '14 at 18:40
  • there are maybe better examples here http://stackoverflow.com/questions/16214300/upload-base64-image-facebook-graph-api/16439233#16439233 but they all fail with the message API calls from the server require an appsecret_proof argument I have no Idea how to get round this in a client side FB call! – ejectamenta Jan 26 '14 at 20:03
  • You may be able to disable the appsecret_proof requirement for testing purposes, see here: https://developers.facebook.com/docs/graph-api/securing-requests/#require-proof – Spone Jan 27 '14 at 08:34
  • Yes the appsecret proof was stopping the code from working which I disabled from within the app settings, it also worked when I used the hashed appsecret code returned from my server – ejectamenta Jan 27 '14 at 08:51

2 Answers2

1

As far as I know, it's not possible. When you share something in the feed, Facebook needs to be able to fetch the image from a public URL.

picture: The URL of a picture attached to this post.

Source: Feed and Share Dialogs

You need to upload the image somewhere first (for instance Amazon S3).

Spone
  • 1,324
  • 1
  • 9
  • 20
0

You can upload your canvas image to dropbox and then use the generated url in facebook feed url - Save image to dropbox with data from canvas

Community
  • 1
  • 1
toyeca
  • 169
  • 2
  • 5