# Flickr.rb - Limiting photo results!

**URL:** <https://www.ruby-forum.com/t/flickr-rb-limiting-photo-results/98990>\
**Category:** Rails\
**Created:** [July 19, 2006, 4:58pm UTC](https://www.ruby-forum.com/t/flickr-rb-limiting-photo-results/98990 "2006-07-19T16:58:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hreyaatnh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f17d59/32.png) [@hreyaatnh](https://www.ruby-forum.com/u/hreyaatnh)\
**Post date:** [July 19, 2006, 4:58pm UTC](https://www.ruby-forum.com/t/flickr-rb-limiting-photo-results/98990/1 "2006-07-19T16:58:01Z")

</div>

I’m returning my photos to my site, but I’m want to limit the result to  
like 5 photos or something. Right now, it’s returning all of my public  
photos.

What I’m attempting is to do some sort of counter loop in the view to  
limit this, but it seems like the API would have a count or a limit  
option.

Does anyone know how to limit the photos returned by  
“user.tag(‘red’)”???

If not, do you know of a good way to loop through and limit the results  
to only showing 5 photos?

Thanks a bunch!

---

<div class="post-metadata">

**Author:** ![hreyaatnh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f17d59/32.png) [@hreyaatnh](https://www.ruby-forum.com/u/hreyaatnh)\
**Post date:** [July 19, 2006, 5:17pm UTC](https://www.ruby-forum.com/t/flickr-rb-limiting-photo-results/98990/2 "2006-07-19T17:17:29Z")

</div>

On 19/07/06 16:58 +0200, ry an wrote:

> I’m returning my photos to my site, but I’m want to limit the result to  
> like 5 photos or something. Right now, it’s returning all of my public  
> photos.
> 
> What I’m attempting is to do some sort of counter loop in the view to  
> limit this, but it seems like the API would have a count or a limit  
> option.

Without looking at the flickr API, the source for flickr.rb does not  
appear to support such an option.

> Does anyone know how to limit the photos returned by  
> “user.tag(‘red’)”???
> 
> If not, do you know of a good way to loop through and limit the results  
> to only showing 5 photos?

user.tags(‘red’)[0…4] should get the first five in the collection.

Good Luck,  
Jason

---

<div class="post-metadata">

**Author:** ![hreyaatnh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f17d59/32.png) [@hreyaatnh](https://www.ruby-forum.com/u/hreyaatnh)\
**Post date:** [July 19, 2006, 5:21pm UTC](https://www.ruby-forum.com/t/flickr-rb-limiting-photo-results/98990/3 "2006-07-19T17:21:28Z")

</div>

Awesome. Thanks!

---

<div class="post-metadata">

**Author:** ![hreyaatnh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f17d59/32.png) [@hreyaatnh](https://www.ruby-forum.com/u/hreyaatnh)\
**Post date:** [July 19, 2006, 6:21pm UTC](https://www.ruby-forum.com/t/flickr-rb-limiting-photo-results/98990/4 "2006-07-19T18:21:42Z")

</div>

The Rails/flickr screencast at  
[http://media.rubyonrails.org/video/flickr-rails-ajax.mov](http://media.rubyonrails.org/video/flickr-rails-ajax.mov) shows a way to  
limit the number returned. They’re getting the pics a different way,  
but  
perhaps you can adapt what they are doing to your purposes.

- foobario
