Possible Duplicate:
Add picture at facebook event with Graph API
I have been trying for a good few hours now to create an event through the Facebook API with an image. So far I have been able to create events though both the Graph and Rest APIs without images, but have been unable to attach any images.
I believe the REST API is the only API which supports attaching images, but the documentation is pretty poor and the php-sdk docs or code do not help much either.
My latest attempt is over at: http://promos.uk.glam.com/splash_test/example.php
With the code: http://pastebin.com/8JC8RAck (note the “require facebook.php” is the php-sdk – http://github.com/facebook/php-sdk/)
Note line 93 ( “if ($uid) {” ), this is supposed to be “if ($me) {“, which was working for an hour or so, and then stopped working (no changes to the code that populates $me), odd.
So, the event creation code is lines 96-99 and as it is now it creates an event without an image, but as soon as I put back in the commented out code (line 98, ) it fails to do anything.
Does anyone know how to create events on facebook though the API with images? If so, please help me out here! I have no problems scrapping all this code if there is another solution, although I have to use PHP or Javascript.
Thanks all
Thanks everyone for your answers, I decided to revisit this to see if the API is working correctly now. It is! Uploading pictures with the Graph API now works. Thanks to Stan James for bringing my attention to this and giving code to post photos, which I adapted for events:
Setup:
Post:
I have put all the code on pastebin (http://pastebin.com/iV0JL2mL), it’s a bit messy from my debugging and getting angry with Facebook months ago! But it works.