Skip to content

Instantly share code, notes, and snippets.

@digitalpardoe
Created July 16, 2011 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalpardoe/1086596 to your computer and use it in GitHub Desktop.
Save digitalpardoe/1086596 to your computer and use it in GitHub Desktop.
Using rFlickr
cp /tmp/flickr.cache /your/rails/application/config/flickr.cache
rm /tmp/flickr.cache
>> flickr.auth.getToken('that_frob_number_we_saved')
>> flickr.auth.cache_token
>> exit
>> flickr.auth.getFrob
class PhotographyController < ApplicationController
API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
SHARED_SECRET = "xxxxxxxxxxxxxxxx"
def index
view
render :action => 'view'
end
def view
flickr = Flickr.new(RAILS_ROOT + "/config/flickr.cache", API_KEY, SHARED_SECRET)
@photos = flickr.people.getPublicPhotos(flickr.people.findByUsername("YOUR_FLICKR_NAME"))
end
end
sudo gem install rflickr --include-dependencies
>> require 'flickr'
>> API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
>> SHARED_SECRET = "xxxxxxxxxxxxxxxx"
>> flickr = Flickr.new("/tmp/flickr.cache", API_KEY, SHARED_SECRET)
>> flickr.auth.token
=> nil
cd /your/rails/application
./script/console
<% for photo in @photos %>
<a href="<%= photo.flickr.photos.getInfo(photo.id).urls.values %>"><img src="<%= photo.url('s') %>" /></a>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment