PHP寻找与GD匹配的图像

I have a folder with about 2000 images size 37x13, when i add a new image i want to look for a pixel perfect match before i add it to the folder.

What i need is a match function, returning true of false, so i can react if there's a match. I imagine it can be done with imagick, but do not have that installed, and would like to be able to do this without installing imagick.

So what i ask is, is there a way to see if an image matches another perfectly with PHP/GD?

I haven't tried this myself, but I would assume that using hash_file would work for what you're trying to do.

Hash both files using hash_file and compare them. If they match, then the images should be the same.

How about doing a hash on the file?

http://ca2.php.net/manual/en/function.sha1-file.php