Download the PHP package intervention/imagehash without Composer

On this page you can find all versions of the php package intervention/imagehash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package imagehash

Intervention ImageHash

Perceptual image hashing for PHP

Latest Version Build Status Monthly Downloads Support me on Ko-fi

Intervention ImageHash is an extension library to Intervention Image and provides perceptual image hashing with different strategies.

A perceptual hash is a fingerprint of a multimedia file derived from various features from its content. Unlike cryptographic hash functions which rely on the avalanche effect of small changes in input leading to drastic changes in the output, perceptual hashes are "close" to one another if the features are similar.

Installation

Install this library using Composer. Add the package with the following command:

Usage

Building Hashes

Using ImageHasher

The ImageHasher serves as the central starting point for all hashing operations. Depending on the PHP environment, a driver must be passed to it that matches the image extension (GD, Imagick or libvips) being used. Here is also the hashing strategy defined.

The library comes with four built-in hashing strategies:

Choose one of these strategies. If you don't know which one to use, try the Difference strategy. Some strategies allow configuration, be sure to check the constructors.

To generate hashes, the hash() method is used, which can read from various image sources like paths, raw image data and more.

Using AnalyzerInterface

Alternatively, you can choose to use Image::analyze() method instead of the ImageHasher. This integrates more seamlessly into an existing Intervention Image processing pipeline, if you already have instances of Intervention\Image\Interfaces\ImageInterface - the results remain the same.

Comparing Hashes

The resulting Hash object, is a hexadecimal image fingerprint that can be stored once calculated. Two fingerprints can be compared by the hamming distance for similarities. Low distance values will indicate that the images are similar or the same, high distance values indicate that the images are different. Use the following methods for comparisons:

Perceptual hashes are a different concept compared to cryptographic hash functions like MD5 and SHA1. With cryptographic hashes, the hash values are random. Comparing two SHA1 hash values really only tells you two things. If the hashes are different, then the data is different. In contrast, perceptual hashes can be compared - giving you a sense of similarity between the two data sets.

A perceptual hash is a compact summary of visual features. Because of that, the hashes are influenced by the input images, the processing strategy and the processing pipeline and may vary with its distance to other hashes depending on these factors.

Converting Hashes

The Hash object can be converted to a couple of different formats:

Parsing Hashes

If you want to reconstruct a Hash object from a previous calculated value, use:

Requirements

Demo

These images are similar:

Equals1 Equals2

Image 1 hash: 8f9e9d8b0f0f1f07 (1000111110011110100111011000101100001111000011110001111100000111)
Image 2 hash: 8e9e958b0f2f1f07 (1000111010011110100101011000101100001111001011110001111100000111)
Hamming distance: 3

These images are different:

Equals1 Equals2

Image 1 hash: 6c2b58432011e38e (0110110000101011010110000100001100100000000100011110001110001110)
Image 2 hash: 8f9e9d8b0f0f1f07 (1000111110011110100111011000101100001111000011110001111100000111)
Hamming distance: 35

Security

If you discover any security related issues, please email [email protected] directly.

Authors

This project is based on work originally developed by Jens Segers and released under the MIT License. Many thanks to him for sharing his code with the community, which made this fork possible.

This version is maintained by Oliver Vogel including modifications and improvements, but it builds directly on the solid foundation Jens created.

License

Intervention ImageHash is licensed under the MIT License.


All versions of imagehash with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
intervention/image Version ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package intervention/imagehash contains the following files

Loading the files please wait ...