Question: 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 );

```

Answer: 
The current code you have is actually calculating the md5 of the file contents. What you already have does what you want.
As you mention content, you might want to have a look at a perceptual hash, such as [phash](http://www.phash.org/)