PHP Class Jenssegers\ImageHash\ImageHash

Mostrar archivo Open project: jenssegers/imagehash

Protected Properties

Property Type Description
$implementation Jenssegers\ImageHash\Implementation The hashing implementation.

Public Methods

Method Description
__construct ( Jenssegers\ImageHash\Implementation $implementation = null, string $mode = self::HEXADECIMAL ) Constructor.
compare ( mixed $resource1, mixed $resource2 ) : integer Compare 2 images and get the hamming distance.
distance ( integer $hash1, integer $hash2 ) : integer Calculate the Hamming Distance.
hash ( mixed $resource ) : integer Calculate a perceptual hash of an image file.
hashFromString ( mixed $data ) : string Calculate a perceptual hash of an image string.

Protected Methods

Method Description
createResource ( string $data ) : resource Get a GD2 resource from string.
destroyResource ( resource $resource ) Destroy GD2 resource.
formatHash ( integer $hash ) : string | integer Format hash in hex.
loadImageResource ( string $file ) : resource Get a GD2 resource from file.

Method Details

__construct() public method

Constructor.
public __construct ( Jenssegers\ImageHash\Implementation $implementation = null, string $mode = self::HEXADECIMAL )
$implementation Jenssegers\ImageHash\Implementation
$mode string

compare() public method

Compare 2 images and get the hamming distance.
public compare ( mixed $resource1, mixed $resource2 ) : integer
$resource1 mixed
$resource2 mixed
return integer

createResource() protected method

Get a GD2 resource from string.
protected createResource ( string $data ) : resource
$data string
return resource

destroyResource() protected method

Destroy GD2 resource.
protected destroyResource ( resource $resource )
$resource resource

distance() public method

Calculate the Hamming Distance.
public distance ( integer $hash1, integer $hash2 ) : integer
$hash1 integer
$hash2 integer
return integer

formatHash() protected method

Format hash in hex.
protected formatHash ( integer $hash ) : string | integer
$hash integer
return string | integer

hash() public method

Calculate a perceptual hash of an image file.
public hash ( mixed $resource ) : integer
$resource mixed GD2 resource or filename
return integer

hashFromString() public method

Calculate a perceptual hash of an image string.
public hashFromString ( mixed $data ) : string
$data mixed Image data
return string

loadImageResource() protected method

Get a GD2 resource from file.
protected loadImageResource ( string $file ) : resource
$file string
return resource

Property Details

$implementation protected_oe property

The hashing implementation.
protected Implementation,Jenssegers\ImageHash $implementation
return Jenssegers\ImageHash\Implementation