sapientpro / image-comparator-laravel
Compare images using Laravel
Installs: 3 255
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
- sapientpro/image-comparator: ^1.1.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0|^11.0
- squizlabs/php_codesniffer: ^3.7.2
This package is not auto-updated.
Last update: 2024-11-15 12:56:30 UTC
README
This package is a wrapper of Image Comparator package adapted to use with Laravel via Facade. All methods of Image Comparator are available in the Facade. For the method reference visit the 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:
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:
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