Reputation: 3
Is it possible to check if two picture are identical with php?
(I want to check if a picture of an event from facebook is the dafault, or not)
Thanks, John
Upvotes: 0
Views: 3103
Reputation: 4236
I'd use a hashing algorithm and compare the two hashes:
if ( sha1_file ( $file1 ) === sha1_file ( $file2 ) ) {
// They're identical
} else {
// They're not
}
This uses sha1_file, but you could use any hashing algorithm.. MD5 for instance
Upvotes: 6
Reputation: 163234
Identical, as in bit for bit? You may be able to simply hash the files, for a (fairly) quick comparison.
If you want to compare visually, that is a completely different matter.
Upvotes: 1