At 11:40 PM +0100 3/21/06, Jofi wrote:
I would like to know if it is technically possible to
add links to the
previous and next image (in alphabetical order) of an image on its page.
Or would it need too much resources to find the next image in the
database?
It would be especially useful for scans of books, where the user could
directly go from one page to the next with such links. At presence the
links have to be added manually. A lot of work for books with 1,000+
pages.
img_name is the primary key for the table, so using SQL to find a page's
neighbors by sort order should be relatively inexpensive. However, if you
are doing this in a program, you might want to
* load the sorted information into an array
* walk the array, creating "next" and "prev" hashes
This would let you do an in-memory lookup of the neighbors, which should
run a bit faster. Of course, this assumes that you have enough memory to
hold these data structures, but RAM is cheaper than fingers. See:
http://meta.wikimedia.org/wiki/Image_table
http://meta.wikimedia.org/wiki/User:RichMorin/mw_image
-r
--
http://www.cfcl.com/rdm Rich Morin
http://www.cfcl.com/rdm/resume rdm(a)cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841
Technical editing and writing, programming, and web development