# Using flickr.rb

**URL:** <https://www.ruby-forum.com/t/using-flickr-rb/64339>\
**Category:** Rails\
**Created:** [June 24, 2006, 1:27pm UTC](https://www.ruby-forum.com/t/using-flickr-rb/64339 "2006-06-24T13:27:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![idlefingers](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/898d66/32.png) [@idlefingers](https://www.ruby-forum.com/u/idlefingers)\
**Post date:** [June 24, 2006, 1:27pm UTC](https://www.ruby-forum.com/t/using-flickr-rb/64339/1 "2006-06-24T13:27:38Z")

</div>

Does anyone have any experience with using flickr.rb? Seems the only  
thing which is documented for it is searching through your photos.

Anyway, all I’m trying to do is return a list of my 20 most recent  
photos, but nothing seems to work.

doing this returns 100 photos for a given user (which takes all day to  
load)

@flickr = Flickr.new ‘API KEY’  
@user = @flickr.users(‘USERNAME’)  
render :partial =\> “/posts/photo”, :collection =\> @user.photos

if I try to add options to @user.photos like (:per\_page =\> 20) it  
doesn’t work.

Any ideas?

---

<div class="post-metadata">

**Author:** ![idlefingers](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/898d66/32.png) [@idlefingers](https://www.ruby-forum.com/u/idlefingers)\
**Post date:** [June 24, 2006, 2:40pm UTC](https://www.ruby-forum.com/t/using-flickr-rb/64339/2 "2006-06-24T14:40:58Z")

</div>

Search through the mailing list archives for a post I made on flickr  
APIs. There’s another API that’s less simple but more complete …

– G.

---

<div class="post-metadata">

**Author:** ![idlefingers](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/898d66/32.png) [@idlefingers](https://www.ruby-forum.com/u/idlefingers)\
**Post date:** [June 24, 2006, 6:14pm UTC](https://www.ruby-forum.com/t/using-flickr-rb/64339/3 "2006-06-24T18:14:00Z")

</div>

I had the same issue, I had to modify the flickr.rb code. Replace the  
photos method in the User class with:

```
def photos(opts=Hash.new)
  opts['user_id'] = @id
  @client.people_getPublicPhotos(opts)['photos']['photo'].collect { 

```

|photo| Photo.new(photo[‘id’]) }  
# what about non-public photos?  
end

Then call it like this:

user.photos({‘per\_page’=\>6.to\_s})

Make sure you pass the parameters as a Hash and the per\_page value is a  
string and not a numeric value otherwise you will get a FixNum  
exception.

cheers,

scott

* * *

What’s an Intel chip doing in a Mac? A whole lor more that it’s ever  
done in a PC.

My Digital Life - [http://scottwalter.com/blog](http://scottwalter.com/blog)  
Pro:Blog - [http://scottwalter.com/problog](http://scottwalter.com/problog)  
Snippets - [http://snippets.scottwalter.com](http://snippets.scottwalter.com)

----- Original Message ----  
From: Damien T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: removed\_email\_address@domain.invalid  
Sent: Saturday, June 24, 2006 6:27:38 AM  
Subject: [Rails] using flickr.rb

Does anyone have any experience with using flickr.rb? Seems the only  
thing which is documented for it is searching through your photos.

Anyway, all I’m trying to do is return a list of my 20 most recent  
photos, but nothing seems to work.

doing this returns 100 photos for a given user (which takes all day to  
load)

@flickr = Flickr.new ‘API KEY’  
@user = @flickr.users(‘USERNAME’)  
render :partial =\> “/posts/photo”, :collection =\> @user.photos

if I try to add options to @user.photos like (:per\_page =\> 20) it  
doesn’t work.

Any ideas?
