PHP code example of sensimedia / facial

1. Go to this page and download the library: Download sensimedia/facial 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/ */

    

sensimedia / facial example snippets




use Sensi\Facial\Detector;

$detector = new Detector;
$detectable = $detector->fromFile('/path/to/file');
var_dump($detectable->hasFace()); // true or false
if ($detectable->hasFace()) {
    $resource = $detectable->getFace();
} else {
    $resource = $detectable->getSource();
}
// Outputs either the face, or the original image if no face was found.
imagejpeg($resource);