Perceptual (average / DCT) hashes in PHP