@@ -158,8 +158,20 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
||||
|
||||
Map<String, Long> hashSearchApiFile = imageHashService.calculateHash(Paths.get(filePath));
|
||||
|
||||
log.info("hashSearchApiFile: " + hashSearchApiFile);
|
||||
log.info("hashSearchApiFile: " + hashSearchApiFile);
|
||||
log.info("hashSearchApiFile: " + hashSearchApiFile);
|
||||
log.info("hashSearchApiFile: " + hashSearchApiFile);
|
||||
|
||||
ImageHashEntity checkFileHash = imageHashRepository.findByFileId(fileId);
|
||||
|
||||
log.info("checkFileHash hi: " + checkFileHash.getHash64Hi());
|
||||
log.info("checkFileHash hi: " + checkFileHash.getHash64Hi());
|
||||
log.info("checkFileHash hi: " + checkFileHash.getHash64Hi());
|
||||
log.info("checkFileHash low: " + checkFileHash.getHash64Lo());
|
||||
log.info("checkFileHash low: " + checkFileHash.getHash64Lo());
|
||||
log.info("checkFileHash low: " + checkFileHash.getHash64Lo());
|
||||
|
||||
boolean hashesAreEqual = hashSearchApiFile.get("hi").equals(checkFileHash.getHash64Hi())
|
||||
&& hashSearchApiFile.get("low").equals(checkFileHash.getHash64Lo());
|
||||
|
||||
|
||||
@@ -26,24 +26,6 @@ public class ImageHashService {
|
||||
|
||||
private final CloudStorageService cloudStorageService;
|
||||
|
||||
// public Map<String, Long> calculateHash(Path imagePath) throws IOException {
|
||||
//// File file = cloudStorageService.readFileFromStorageByPath(imagePath.toString());
|
||||
// File file = imagePath.toFile();
|
||||
// if (file == null) {
|
||||
// file = cloudStorageService.readFileFromStorageByPath(imagePath.toString());
|
||||
// }
|
||||
//
|
||||
// PHash pHash = PerceptualHashHelper.INSTANCE.generateDCTPerceptualHash(file);
|
||||
//
|
||||
// Long firstPart = pHash.getFirstPart();
|
||||
// Long secondPart = pHash.getSecondPart();
|
||||
// Map<String, Long> hash = Map.of(
|
||||
// "hi", firstPart,
|
||||
// "low", secondPart);
|
||||
//
|
||||
// return hash;
|
||||
// }
|
||||
|
||||
public Map<String, Long> calculateHash(Path imagePath) throws IOException {
|
||||
PHash pHash;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user