Friday, October 6, 2017

phpbb forum: Added Image Search feature to the forum.

On my gimplearn.net phpbb forum, I could search and advance search but it seems you can only select to search in posts' subject/title and/or posts' message.

I wanted the ability to search through image files (via real filenames) as well.
There doesn't seem to be any phpbb extension that does it (or at least I couldn't find it).

So I wrote my custom pages to do it and a table to keep track of image searches that had been performed.

I created a page that you can submit an image search to.
It's located here: https://gimplearn.net/isearch.php (or you can access at the bottom links of any page on the forum)

All that page does is it has a simple form that you can submit a search to.
It then submits to /imagesearch.php with a 'q' GET parameter.
For example, if you search for 'buddha'.
It would submit to https://gimplearn.net/imagesearch.php?q=buddha
Then imagesearch.php would show you the same form again just in case user wanted to search for something else.

imagesearch.php also does the work of showing results (with pagination).
imagesearch.php would also record what 'q' was and save it to my table (of searches that had been performed) and the number of results it found.

Then I have another custom page that shows image searches that had been performed on gimplearn.net.  It's located at https://gimplearn.net/isearches.php.

And that's it.  Now users on my forum can search for images via real filenames of attachments.

For more technical details (code) on how to implement something similar on your phpbb forum, you can go to phpbb Forum: How I added Image Search feature to the forum.