public static function byImage($inputFilePath) { $binaryHash = sha1_file($inputFilePath); $phash = ph_dct_imagehash($inputFilePath); if (!$phash) { return false; } $results = ImageHash::whereRaw('binary_hash = ? or bit_count(phash ^ ?) <= ?', array($binaryHash, $phash, self::SEARCH_THRESHOLD))->get(); $paths = array(); foreach ($results as $hash) { $record = $hash->pathRecord; $path = $record->getPath(); $paths[$record->id] = $path; } return $paths; }