dev add method link
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-06 12:45:00 +07:00
parent 3fd4cbeab5
commit 8b8db46c29
2 changed files with 12 additions and 18 deletions
@@ -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;