views:

136

answers:

3

So what I am trying to do is post an image that has been created by a user on an iphone into that users newsfeed.

The functionality I am having a hard time understanding if it is possible:

Can I pass a local NSURL (or URL?)(to a png file that lives in the documents folder) through a JSON string and onto Facebook?

i want to mimic the action of a user going to his/her facebook page, clicking into the textfield for their newsfeeld, uploading an image by clicking the "photos" icon and selecting an image from a local disk and uploading it. I would also like to add some text into the post optionally.

I'm just getting started with the Facebook api and it seems pretty tough right now, any help would be appreciated. code examples appreciated.

Thanks,

Nick

+2  A: 

You'll need to use a third-party image host like YFrog or roll your own image host. Facebook requires that all media attachments (including photos) be hosted on the public web. Even though they cache the images themselves, the URL that you send to them has to have its own public URL. Many of the popular Twitter image hosts have simple REST APIs to achieve this.

warrenm
Any idea if it would need to be hosted only as long as the transfer takes or does it need to be there after that? Just wondering if I can get a way with simply uploading it temporarily to my own site or something like that and just dumping it after a certain time?
nickthedude
From what I've seen, the very reason Facebook caches it is to prevent broken links. So I think you could easily get away with storing it for a set period of time.
warrenm
thanks warren! really appreciate the response.
nickthedude
A: 

Just to clarify this. I was actually able to pass and image directly from the iPhone without a third party but that was posting an image to a users photo album. There are I think two methods in the fbconnect api for posting one contains an extra argument for a data argument which can be an image. I'll post more details when I'm in front of the documentation.

nickthedude
+1  A: 

You can also use Facebook itself to host the image via their photo.upload API, if you don't mind two side-effects: it will appear in the user's photo albums, and the thumbnail is likely to appear in the stream twice (once representing the addition to the photo album, and the second in the actual stream story you publish). You can't currently get around this doubling artifact, but it will give you a stable host for the uploaded image.

quixoto