我正在使用此代码将图片发布到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
如果有人知道解决方案,请告诉我
答案 0 :(得分:-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