To expand on this post:
What if you could tell a computer what you were looking for, in general, and have it find it for you?
What if you could sketch a picture and have matches found for you based on your input?
Here's how: Query images by signature, query images by overall similarity, and a real implementation: Retrievr.
I prefer approach number 2; which is harder to implement but probably a lot more effective.
I wonder if there's any Java implementations out there that could be bootstrapped into PHP nicely.