Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

htg

macrumors regular
Original poster
May 2, 2009
125
0
The title probably hasn't explained it at all well, so let me clarify:

I know basic HTML, and I'm wondering how you would do this.

I want to be able to have a search box on my site that will allow visitors to search for photos that are hosted on the site's server.

So, totally random example: if you've uploaded a photo of a cat to the photos folder on the website's server entitled 'cat.jpg' I want people who visit the site to be able to type cat into the search box so that they can find and view the photo.

I don't think it's super hard to do and I don't think it would require a database either as all you're doing is searching one folder.

Any help appreciated.
 
HTML can't do that by itself; you'll need a script that runs on the server that can look in the photos directory and return the results formatted as HTML.

A very popular scripting language is PHP. Functions that you will likely find useful include scandir() to get a directory listing, foreach() to iterate through each entry (file name) in that directory listing, and stripos() to determine if the search string matches part of the filename.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.