Quite simply this is what i'm trying to do. I have a folder on my server full of images and I need to be able to search via a form and have it return the images that match the search. I can't seem to find anything simple to accomplish this. I'm not looking for anyone to do it for me but if anyone knows of a simple script already available or a resource to point me in the right direction that would be great. Thank you in advance.
Are you searching by the file name or something else? It wouldn't be very difficult to write a script that searching for some part of the file names.
I don't know if you'll find a script for this simple task. Just load the directory into an array and parse the filenames for the search string. Display those that match.
Yes the files all have descriptive filenames so that they can be searched easily. An example filename would be "brandon at CES 2013 at booth 15602 with company x". There are like 100k image files though so was trying to avoid creating a database with all of them entered but want to allow someone to type "brandon ces 2013" and get a list of the files with that in the name.
look: $file_list = scandir("load of pics here"); foreach ($file_list as $file) { if (stristr($file, "Search Text")) { // Output HTML } } Code (markup): So anyone that tries to sell/give you a tool for this is being, well, a tool
Thank you this is perfect I was reading the array wrong before this will work great. I can search through the array for terms. Thank you.
I think a database may still be more efficient especially if you're looping through every file each time you search for 1. File operations are often much slower and 100,000 is a decent enough size data set that it might be worthwhile to use a small database for the purpose. If you do go down that route, I would just insert the name to the database at the time the file is uploaded to the server, and delete it when a file is removed.