Have you tried hash_file? to see if you get the right results.
I am not sure why it would give you different values though, have you tested it with other images files from different sources. I tried it myself with dropbox and local copies and hash and hash_file work as they are supposed to.
There are algorithms out there for that. Specially for image caching for search engines like google. I am not familiar with those algorithms, Maybe there is a library that you can use or port to PHP to use.
Edit: This is the closest thing I could find quick, probably a starting point.