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
    by
    thumbnail. I want to let the user change how many thumbs they can see
    per
    page. I’ll have a couple links at the bottom of the page letting them
    do
    that. The problem is, if they are in the middle of browsing and decide
    to
    change their page size, the new (different sized) page will probably
    have
    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
    the
    page size bigger it will need fewer pages to show everything, narrowing
    the
    range of valid page numbers). I know I could fix this by not letting
    the
    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
    (and
    possibly dumber). I’m also going to have a slideshow, which will use
    Ajax.
    When you click next, it will send you to the next image in the album.
    But
    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
    way.

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

-Ryan


View this message in context:
http://www.nabble.com/Reverse-engineering-pagination-and-more-t1745080.html#a4743235
Sent from the RubyOnRails Users forum at Nabble.com.