Question

I am using this code to post images to 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

but I am not able to open local images

No such file or directory @ rb_sysopen - index5.jpeg

if any one knows solution please let me know

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top