0

I'm using carrierwave + fog to work with S3. I'm saving images there, then I need to grab one of this image and post it to fb... So what I need to do is to download the image to the server, I couldn't find a way of doing this with carrierwave... And I don't know how to do it because to post the image to fb I need to call a POST to their api with a FILE... It would be great to post using the url of the S3 server...

Any idea on how I can do this?

Thanks!

Andres
  • 11,439
  • 12
  • 48
  • 87

2 Answers2

2

yes, you can post image directly using the url. I too post s3 image to facebook. With I call the api something like:

$photoId = $facebook->api("me/photos","POST",array('url'=>$pictureUrl,'message'=>'this picture posted using url'));
$photoId = $photoId['id'];

so I hope you should be able to do similar in ruby-on-rails.

Smita
  • 4,634
  • 2
  • 25
  • 32
0

The way to do this is:

RestClient.post "https://graph.facebook.com/#{album_id}/photos",
            :message => photo_message,
            :access_token => access_token, 
            :url => "http://youdomain.com/yourimage.jpg"    

I'm using a great gem to consume the rest api called rest_client!

I hope this is useful for someone!

Andres
  • 11,439
  • 12
  • 48
  • 87