【问题标题】:How to post Image to facebook using koala gem如何使用考拉宝石将图像发布到 Facebook
【发布时间】:2014-02-28 07:00:28
【问题描述】:

我正在使用此代码将图像发布到 facebook

 def post_to_facebook(facebook_auth)
    graph = Koala::Facebook::GraphAPI.new(facebook_auth.token)
       graph.put_wall_post(self.message, {
      "picture" => self.avatar.url(:thumb),
      "description" => self.message
        })
 end

但我无法打开本地图片

没有这样的文件或目录@rb_sysopen - index5.jpeg

如果有人知道解决方案,请告诉我

【问题讨论】:

  • 这和PostgreSQL有什么关系? 困惑
  • 我正在使用 pg 作为数据库

标签: facebook ruby-on-rails-3 web-services koala


【解决方案1】:
def post_to_facebook(facebook_auth,image,content)
      begin
         graph = Koala::Facebook::GraphAPI.new(facebook_auth.token)
         graph.put_picture(image,content,{:message => self.message})
         rescue Faraday::Error::ConnectionFailed => e  
      end  
end

【讨论】:

    猜你喜欢
    • 2016-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-22
    • 2014-12-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多