Reputation: 1950
I currently create a hash from an image name but would rather create a hash based on the contents of an image so I can detect duplicate images. Are their any PHP classes that do this?
My current code is very simple:
$image = "image1.jpg";
$filehash = md5_file($image );
Upvotes: 3
Views: 4171
Reputation: 2114
As you mention content, you might want to have a look at a perceptual hash, such as phash
Upvotes: 3
Reputation: 163334
The current code you have is actually calculating the md5 of the file contents. What you already have does what you want.
Upvotes: 6