Reverse engineering pagination and more

Hey all,
I’m building a photo album site (for fun) and have a few questions.

  1. This site will have a browse section, where you can view the photos
    thumbnail. I want to let the user change how many thumbs they can see
    page. I’ll have a couple links at the bottom of the page letting them
    that. The problem is, if they are in the middle of browsing and decide
    change their page size, the new (different sized) page will probably
    completely different pictures on it from the one before they changed the
    size. Even worse, the page number may simply be invalid (if you make
    page size bigger it will need fewer pages to show everything, narrowing
    range of valid page numbers). I know I could fix this by not letting
    user change WHILE they are browsing, but I’m curious:

Is there a decent way to determine what page a specific photo is on
based on
the page size? I’m ordering these photos by the date they were taken at
(based on EXIF data).

  1. This is the same flavor of a question I believe, but more critical
    possibly dumber). I’m also going to have a slideshow, which will use
    When you click next, it will send you to the next image in the album.
    how do I figure out what the next image is? Is there a way to select a
    range of records arounds an exact one? I realize I can use sessions to
    store an index or something, but I wasn’t sure if there was a better

Thanks in advance. I’m sure I’ll get some clever suggestions.


View this message in context:
Sent from the RubyOnRails Users forum at