PHP code example of sapientpro / image-comparator-laravel
1. Go to this page and download the library: Download sapientpro/image-comparator-laravel library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sapientpro / image-comparator-laravel example snippets
use SapientPro\ImageComparatorLaravel\Facades\Comparator;
$imageHash = Comparator::hashImage('path_to_image.jpg')
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