Skip to content

Commit

Permalink
- updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Matsotskyi committed May 1, 2023
1 parent 5d29991 commit b782248
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
Image Comparator Laravel
# Image Comparator Laravel: Compare images using Laravel

This package is a wrapper of [Image Comparator package](https://github.com/sapientpro/image-comparator)
adapted to use with Laravel via Facade. All methods of Image Comparator are available in the Facade.
For the method reference visit the [wiki](https://github.com/sapientpro/image-comparator/wiki)

## Prerequisites
* php 8.1 or higher
* Laravel 8 or higher
* Gd extension enabled

## Installation

You can install the package using Composer:
`composer require sapientpro/image-comparator-laravel`

## Usage

You can start using the Image Comparator Facade by including it in your class:

```php
use SapientPro\ImageComparatorLaravel\Facades\Comparator;

$imageHash = Comparator::hashImage('path_to_image.jpg')
```

By default, the average hashing algorithm is user for hashing and comparing images.
If you want to use difference hashing algorithm, you set it with `setHashStrategy()` function:

```php
use SapientPro\ImageComparatorLaravel\Facades\Comparator;
use SapientPro\ImageComparator\Strategy\DifferenceHashStrategy;

Comparator::setHashStrategy(new DifferenceHashStrategy());

$similarity = Comparator::compare('path_to_image1.jpg', 'path_to_image2.jpg') // will use difference hash algorithm
```

0 comments on commit b782248

Please sign in to comment.