Getting Started With Flickr on Rails
Posted by Max Dunn Thu, 06 Jul 2006 17:47:00 GMT
I have been working on a Flickr mashup on my wiki so that I can easily insert links to my Flickr pictures. There are several Flickr libraries for Rails, but the documentation is not very good. So here are some instructions for getting a Flickr library working with Rails.
(Note: On August 28, 2006, I expanded and updated these instructions at: http://www.maxdunn.com/RoR+and+Flickr)
I used the rflickr package rather than flickr, because it is more powerful, and I liked the direct mapping between the Flickr API and the rflickr calls. You can find rflickr at:
http://rubyforge.org/projects/rflickr/
The easiest way to install rflickr is to use gem:
gem install rflickr
If you have the other flickr package installed, you will need to uninstall it since they use the same object name. To uninstall it use:
gem uninstall flickr
If your host doesn’t have this installed, you can install it into your Rails directory. You will need to use the above gem command to install it locally first, and then you will copy over the files manually to your vendor/plugins directory (or add them to SVN). Here are the source directories to copy:
c:\Program Files\ruby\lib\ruby\gems\1.8\gems\rflickr-2006.02.01
c:\Program Files\ruby\lib\ruby\gems\1.8\gems\mime-types-1.15
Copy both of these directories to this parent directory on your host:
After this is setup, get an Flickr API key:
http://www.flickr.com/services/api/keys/
Be sure to note that shared secret.
The next tricky part in using the Flickr API even without a login, you need to use the key and shared secret to generate a Flickr token. I found this page particularly helpful in doing this:
http://lists.rubyonrails.org/pipermail/rails/2006-May/042399.html
Now the documentation on rflickr is basically non-existent. But it follows the Flickr API very closely, so you can use the Flickr API page to figure out what the calls do:
Thanks for the tutorial – very helpful. Just one thing – include this url in it so that people don’t have to spend half the day trying to find their stupid “not visible anywhere” flickr id :)
http://idgettr.com/
Thanks for the tutorial. But the link : http://www.maxdunn.com/rails_flickr.zip doesn’t work !
Sorry about the broken link. I fixed it on the web page so it now points correctly to:
http://www.maxdunn.com/files/maxdunn/rails_flickr.zip
Thanks for the info..