Skip to content

Commit b782248

Browse files
author
Vadim Matsotskyi
committed
- updated readme
1 parent 5d29991 commit b782248

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,38 @@
1-
Image Comparator Laravel
1+
# Image Comparator Laravel: Compare images using Laravel
2+
3+
This package is a wrapper of [Image Comparator package](https://github.com/sapientpro/image-comparator)
4+
adapted to use with Laravel via Facade. All methods of Image Comparator are available in the Facade.
5+
For the method reference visit the [wiki](https://github.com/sapientpro/image-comparator/wiki)
6+
7+
## Prerequisites
8+
* php 8.1 or higher
9+
* Laravel 8 or higher
10+
* Gd extension enabled
11+
12+
## Installation
13+
14+
You can install the package using Composer:
15+
`composer require sapientpro/image-comparator-laravel`
16+
17+
## Usage
18+
19+
You can start using the Image Comparator Facade by including it in your class:
20+
21+
```php
22+
use SapientPro\ImageComparatorLaravel\Facades\Comparator;
23+
24+
$imageHash = Comparator::hashImage('path_to_image.jpg')
25+
```
26+
27+
By default, the average hashing algorithm is user for hashing and comparing images.
28+
If you want to use difference hashing algorithm, you set it with `setHashStrategy()` function:
29+
30+
```php
31+
use SapientPro\ImageComparatorLaravel\Facades\Comparator;
32+
use SapientPro\ImageComparator\Strategy\DifferenceHashStrategy;
33+
34+
Comparator::setHashStrategy(new DifferenceHashStrategy());
35+
36+
$similarity = Comparator::compare('path_to_image1.jpg', 'path_to_image2.jpg') // will use difference hash algorithm
37+
```
38+

0 commit comments

Comments
 (0)