Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Take a library to get the hash of an image using the pHash algorithm or similar (you need to experiment with the sensitivity threshold), as for example Aleksey Skobkin gave a link .
1. Fill in the phash column with the hash values of all available images.
2. When uploading to the server, having received the hash from the image, check it against the database like:
SELECT id FROM images WHERE HammingDistance(images.phash, uploaded_phash) < 8
LIMIT 1
search for complete duplicates.
if not too lazy to figure it out, then there is what you need:
https://github.com/akeneo/pim-community-dev/tree/m...
https://github.com/akeneo/pim-community-dev/tree/ m...
with each file, its hash is added $sha1 = sha1_file($rawFile->getPathname());
you can search the repository by hashes:
$newFile = new \SplFileInfo('path\to\file.jpg');
$hash = sha1_file($newFile->getPathname());
$repositoryFileInfo = $this->getContainer()->get('akeneo_file_storage.repository.file_info');
$savedFile = $repositoryFileInfo->findOneBy(['hash' => $hash]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question