Permlink Replies: 0 - Pages: 1 Threads: [ Previous | Next ]
kaya

Posts: 28
Registered: 19-Jun-2003
Searching photos without server side scripting nor database
Posted: 27 Apr 10, 08:01
  Click to reply to this thread Reply
Searching for tagged photos within an album is a nice feature but normally this requires server side scripting and a database which is not easy to install and maintain for most Jalbum users.
Well, for huge photo libraries of multiple ten thousands of photos I wouldn't want to miss a database but for little or medium sized photo albums, I have developed a search feature which works very well without needing any server side technologies. Just choose which info should be searchable (title, name, comment, keywords, exif, info+ etc.), generate the album, upload it and you're done :)

The concept is simple: while Jalbum generates images and html pages, I let build in parallel a search index file in which are stored all information to be searched. It also contains information which I need to build dynamically gallery and slide pages on client side, as for example paths to thumbnails and slide images, titles, comments etc.

When an album visitor enters some search terms, the query goes via GET to another html page. I choosed GET so the album visitor can copy & paste the URL to send it by e-mail to anyone who might be interseted in the search result. The html page which receives the query reads out the GET parametres and loads through ajax the search index file. The index file is in json format, so it can be easily picked up by an javascript and dependent on the searchable information (e.g. search only in titles) it goes through for any matches. As long as the maximum number of results is not reached, the javascript builds dynamically a html structure in which the matched thumnail images are embedded.
The album visitor may also enter multiple words to refine the search, since all words must match.

To make images better searchable, I have added a custom UI so that the user can enter keywords for images or for folders. Before building the search index, the user can choose whether photos are searchable not only by its own keywords or by keywords of the folder which contains the photo but also whether it can be searched by keywords of all its parent folders. Of course, any other information as for example exif, comments etc. can be made searchable too. I let choose the user.
The drawback is, that the search index file may blow up if one doesn't use any optimization. A quick test I made showed up that about 1000 photos located in about 50 folders resulted in a 450 kB index file. As the information is highly redundant, it may be compressed by factor 10 though.

Finally I got all working and I'm proud to present it to you. If you want to have a look at a live example, here you go:
http://kaya.jalbum.net/LightFlow/v3/samples.html
(see the first example album)

Well, I thought that could be interesting for other skin developers as well. I'm sure that users will appreciate such a feature a lot!

Regards,
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums