Search code examples
ruby-on-railsfacebook-graph-apiamazon-s3carrierwavefog

Downloading Image to tmp folder from S3


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!


Solution

  • 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!