如何使用phasher检测数据库中的类似图像?

I'm building a search image engine, so I need to detect similar / duplicated images in a database and I've found phasher.

This class helps me create hash strings for every image. I can easily compare two images, but now I want to search on a large database to find if a particular image has any clones or similar images?

How can I search with the image hash string?

I think I am building a tool looks like yours but search engine for Facebook profiles pictures I call it FBpp = "Facebook Profile Picture";

I didn't finish it yet it's something I build to sharpen my skills in programming.

I think this is what you are looking for.

<?php

//Require config.php file to connect with mysql server and the db.
require_once('config.php');

//Calling PHasher class file.
include_once('phasher/phasher.class.php');
$I = PHasher::Instance();

$testImage = "./avatar/4.jpg";

$hash = $I->FastHashImage($testImage);
$hex = $I->HashAsString($hash);

$result = mysql_query("SELECT `fid`,`hash` FROM `images`");

while($row  = mysql_fetch_array($result)){
    if($row['hash'] == $hex){
        //echo $row['hash'];
        $fid = $row['fid'];
        echo "<a href='https://www.facebook.com/$fid/'><img src='https://graph.facebook.com/$fid/picture?type=large'></a>";
    }
}