Reputation: 3105
Using Omniauth version 1.0.2, currently when I call env["omniauth.auth"]["info"]["image"]
to get the image for the current user I get a URL:
http://graph.facebook.com/100002739564577/picture?type=square
This redirects to the actual jpeg url which is what I want:
http://profile.ak.fbcdn.net/hprofile-ak-ash2/532749_100003719364175_332972681_a.jpg
Is it possible to get the jpeg url directly in rails?
Thanks
Upvotes: 1
Views: 411
Reputation: 491
You don't necessarily have to if you want to display the image.
This works:
<img src="http://graph.facebook.com/100002739564577/picture?type=square" />
If you must however, try this:
url = URI.parse('http://graph.facebook.com/100002739564577/picture?type=square')
res = Net::HTTP.get_response(url)
res['location'] #returns the image URL
Upvotes: 2