src/ImageCompare.php
public function compare($pathOne, $pathTwo) {
        $i1 = $this->createImage($pathOne);
        $i2 = $this->createImage($pathTwo);

        if (!$i1 || !$i2) {
            return false;
        }

        $i1 = $this->resizeImage($pathOne);
        $i2 = $this->resizeImage($pathTwo);

        imagefilter($i1, IMG_FILTER_GRAYSCALE);
        imagefilter($i2, IMG_FILTER_GRAYSCALE);

        $colorMeanOne = $this->colorMeanValue($i1);
        $colorMeanTwo = $this->colorMeanValue($i2);

        $bits1 = $this->bits($colorMeanOne);
        $bits2 = $this->bits($colorMeanTwo);

        $hammeringDistance = 0;

        for ($x = 0; $x < 64; $x++) {
            if ($bits1[$x] != $bits2[$x]) {
                $hammeringDistance++;
            }
        }

        return $hammeringDistance;
    }
public function compare($pathOne, $pathTwo) {
        $i1 = $this->createImage($pathOne);
        $i2 = $this->createImage($pathTwo);

        if (!$i1 || !$i2) {
            return false;
        }

        $i1 = $this->resizeImage($pathOne);
        $i2 = $this->resizeImage($pathTwo);

        imagefilter($i1, IMG_FILTER_GRAYSCALE);
        imagefilter($i2, IMG_FILTER_GRAYSCALE);

        $colorMeanOne = $this->colorMeanValue($i1);
        $colorMeanTwo = $this->colorMeanValue($i2);

        $bits1 = $this->bits($colorMeanOne);
        $bits2 = $this->bits($colorMeanTwo);

        $hammeringDistance = 0;

        for ($x = 0; $x < 64; $x++) {
            if ($bits1[$x] != $bits2[$x]) {
                $hammeringDistance++;
            }
        }

        return $hammeringDistance;
    }
public function compare ( $ pathOne , $ pathTwo ) { $ i1 = $ this -> createImage ( $ pathOne ) ; $ i2 = $ this -> createImage ( $ pathTwo ) ; if ( ! $ i1 || ! $ i2 ) { return false ; } $ i1 = $ this -> resizeImage ( $ pathOne ) ; $ i2 = $ this -> resizeImage ( $ pathTwo ) ; imagefilter ( $ i1 , IMG_FILTER_GRAYSCALE ) ; imagefilter ( $ i2 , IMG_FILTER_GRAYSCALE ) ; $ colorMeanOne = $ this -> colorMeanValue ( $ i1 ) ; $ colorMeanTwo = $ this -> colorMeanValue ( $ i2 ) ; $ bits1 = $ this -> bits ( $ colorMeanOne ) ; $ bits2 = $ this -> bits ( $ colorMeanTwo ) ; $ hammeringDistance = 0 ; for ( $ x = 0 ; $ x < 64 ; $ x ++ ) { if ( $ bits1 [ $ x ] != $ bits2 [ $ x ] ) { $ hammeringDistance ++ ; } } return $ hammeringDistance ; }
Main function. Returns the hammering distance of two images' bit value.

@param string $pathOne Path to image 1
@param string $pathTwo Path to image 2

@return bool|int Hammering value on success. False on error.
Main function . Returns the hammering distance of two images bit value .