Closed squidarth closed 12 years ago
Ever figure this out? I'm dealing with the same issue now.
Yeah, I ended up figuring it out.
I posted an answer to my problem on stackoverflow--check it out!
Facebook recently released an update that lets you post pictures using publicly accessible URLs: http://developers.facebook.com/blog/post/526/ Which Koala supports (https://github.com/arsduo/koala/blob/master/lib/koala/graph_api.rb#L102), so you should be able to post the pictures you're hosting on S3 without having to use OpenURI::Buffer.
Best,
Alex
I still get the same undefined method multipart_requires_content_type? for Koala:Module
error when using the put_picture method.
Which version of Koala are you using? We've removed multipart_requires_content_type? completely in the 1.2 betas (it's no longer needed) -- can you give the same code a try with that version?
Just tried using the 1.2.0beta3. Uploading via URL works but it's not getting posted to the right place. Here's how I'm calling it:
object = graph.put_object(facebook_account_id, 'events', params)
graph.put_picture(self.flyer.url, object['id']) if self.flyer?
With this code, though, the photo is getting posted to my app page and not the event which was just created.
I've also tried calling it like this:
graph.put_picture(self.flyer.url, {}, object['id']) if self.flyer?
and like this:
graph.put_picture(self.flyer.url, nil, object['id']) if self.flyer?
Same result either way
I'm reopening this issue and will take a look next week to see why it's not properly posting to the event's wall.
Any update on this issue?
My apologies -- it's been a busy few weeks. I'll take a look at this shortly.
I've got this working, here is some sample code (note, it's not multi-part but just an AWS link)
@foo = Foo.find(params[:foo_id])
albuminfo = @graph.put_object('me','albums', :name=>@foo.title)
album_id = albuminfo["id"]
@graph.put_picture(foo.remote_image_path,{}, album_id)
@banane, is the image posted to the proper place? e.g. if it's for an event, is it posted to the event? Because the problem I'm having is that the image is being posted to the FB app wall and not the event. See my last comment on Sep 16, 2011. I was trying pretty much the exact same code as you just posted.
Ah you're right, it's not that simple. Are you uploading to the events' icon wall or to the feed? The only stuff I got to work was creating an event with a picture, not uploading a photo to an event's wall or album.
what about this:
eid="your event id"
file ="http://catsinsinks.com/images/cats/rotator.php"
@graph.put_wall_post("me", {:name => "me", :link => "http://www.banane.com", :picture=>file}, eid)
I'm posting to the event with the ID received from creating the event. The problem though is that the image is getting posted to my application's wall instead of the event. It seems to be an issue with getting the proper ID to Koala for where the image should go.
Is anyone still seeing this, or has the issue been resolved by Facebook or worked around?
Best,
Alex
Going to resolve this now, please reopen if it's still an issue.
Hi I'm trying to upload a picture form amazon s3 to facebook but i get this error
Koala::Facebook::ClientError (type: OAuthException, code: 324, message: (#324) Missing or invalid image file [HTTP 400]):
here is my code:
mime = MIME::Types.type_for(photo.picture_file.url).first.content_type
graph.put_picture(photo.picture_file.url,mime,{:message => photo.description}, photo.gallery.fb_oid)
@jhlive make sure photo.picturefile.url is not something like ".png?23453678", instead it should be like "_.png"
i checked it and everything looks fine but i'm still getting that error, does anyone knows if i have to pass another parameter in order to this work, and by the way i'm using carrierwave to upload files to my s3 bucket
I solved it using a method similar to the one that @squidarth did, i dont know why it gave that error to me when i passed jus the url
Hey guys,
I followed the following blogpost http://horserumble.com/creating-facebook-events-with-koala to figure out how to create Facebook events using Koala. The code that is used to create Facebook events is as follows.
graph = Koala::Facebook::GraphAPI.new(oauth_access_token) picture = Koala::UploadableIO.new(File.open("PATH TO YOUR EVENT IMAGE"))
picture is not required
params = { :picture => picture, :name => 'Event name', :description => 'Event description', :start_time => Time.now + 3.days, :end_time => Time.now + 10.days }
graph.put_object('me', 'events', params )
Now, my problem is that instead of using a picture from path, I would like to use images from Amazon Web Services. However when I substitute the path to an event image for my AWS url, Rails throws an error, saying that directory was not found. When I do not use a File object, and instead write
picture = Koala::UploadableIO.new('http://www......') Ralis throws the following error: NoMethodError (undefined method `multipart_requires_content_type?' for Koala:Module):
Does anybody know how I can pass pictures from urls instead of from file when creating Facebook events with Koala?
I appreciate any insight into what's going on. Thank you all so much.
Best, Sid