3

BACKGROUND: Each user has their Facebook profile image URL associated with their account. This image is called using <%= image_tag(@user.facebook_image_url) %>. Each user's Facebook URL takes the following form: http://graph.facebook.com/123456/picture - with 123456 being the user's particular Facebook ID number.

OBJECTIVE: I'd like to prevent other users from being able to figure out who the user is simply by right-clicking 'copy image url' and looking at the ID in the image URL.

Is there a gem/plugin or better way to accomplish this other than downloading the user's image from Facebook's servers?

neon
  • 2,811
  • 6
  • 30
  • 44
  • You could request that URL server-side, then get where it redirects to, as that is really just an alias for something like `http://profile.ak.fbcdn.net/hprofile-ak-snc4/12345-678910.jpg`. – Andrea May 03 '11 at 14:07
  • interesting. great catch. any suggestions on how to figure out that redirect URL using ruby/rails? – neon May 03 '11 at 14:24
  • 1
    Exact duplicate of http://stackoverflow.com/questions/5836681/securely-storing-a-facebook-image-url-rails-3 – Jesse Wolgamott May 03 '11 at 14:53
  • If you're going to pose a new question, ie. http://stackoverflow.com/questions/5872210/get-redirect-of-a-url-in-ruby/5872658#5872658 then make a note in your old question that you've done this - so efforts aren't duplicated. – smathy May 03 '11 at 20:03

1 Answers1

1

AFAIK, there are only two options: Either you download the image as you say and deliver it to the browser with your own url, or you let the browser do the work in which case the browser (and it's user) has to know the url.

Have a look at Get Facebook real profile image URL. It seems, facebook performs some kind of redirecting. Perhaps you can use that for your purpose.

Community
  • 1
  • 1
moritz
  • 25,477
  • 3
  • 41
  • 36