Created
July 16, 2011 18:01
-
-
Save digitalpardoe/1086596 to your computer and use it in GitHub Desktop.
Using rFlickr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp /tmp/flickr.cache /your/rails/application/config/flickr.cache | |
rm /tmp/flickr.cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> flickr.auth.login_link | |
=> "http://some.link.flickr.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> flickr.auth.getToken('that_frob_number_we_saved') | |
>> flickr.auth.cache_token | |
>> exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> flickr.auth.getFrob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo gem install rflickr --include-dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> require 'flickr' | |
>> API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
>> SHARED_SECRET = "xxxxxxxxxxxxxxxx" | |
>> flickr = Flickr.new("/tmp/flickr.cache", API_KEY, SHARED_SECRET) | |
>> flickr.auth.token | |
=> nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /your/rails/application | |
./script/console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% 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