I can't get your example to work.
This statement, you said:
"when a user clicks the link, a page is created, associated with the page's thumbnail"
That is what a database is for. A database (or catalog) of all images that can be searched. A PHP script then creates the "page" for the user ... it's not really a web page.
This forum you are using now has no web "pages". Every "page" you see is the result of a PHP script that renders it to your browser.
I have another thought ...
What if each photo (or picture) has a descriptive filename that could be used for a search.
Example of some filenames:
You would not really need a database ... just a PHP script to search for any filenames that have the target search word, or similar words. But if the images and filenames already exist, you can hardly rename everything.
And there are no pages ... just a search box.
A database of course would be best (like MySQL). It has some powerful query features that would be better for a comprehensive system.