PHP code example of eduardostuart / face
1. Go to this page and download the library: Download eduardostuart/face 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/ */
eduardostuart / face example snippets
return [
// ....
Face\FaceServiceProvider::class,
]
return [
// ....
'Face' => Face\Facades\Face::class,
]
php artisan vendor:publish --provider="Face\FaceServiceProvider"
// ...
use Face;
$results = Face::detect('https://.../photo.jpg');
// ...
use Face;
$album = Face::createAlbum("my album name", [
"face-id-1", "face-id-2",
]);
// $album->getName();
// $album->getTags();
// $album->getFaces();
// $album->toJson();
// $album->toArray();
// ...
use Face;
if(Face::removeAlbum("album-id")){
echo "OK!";
}
// ...
use Face;
$albumUpdated = Face::updateAlbum("album-id", "new album name");
// ...
use Face;
$albums = Face::albums();
print_r($albums->toArray());
// ...
use Face;
$album = Face::album("album-id");
echo $album->getName();
// ...
use Face;
if(Face::addIntoAlbum("album-id", ["face-1-id","face-2-id"])){
echo "Added!";
}
// ...
use Face;
if(Face::removeFaceFromAlbum("album-id", ["face-1-id","face-2-id"])){
echo "Removed!";
}
// ...
use Face;
$albumId = '1234';
$result = Face::search($albumId, 'https://.../photo.jpg');
// $result->getTotal();
// $result->getResults();
// ...
use Face;
$result = Face::getFace('face-id');
// $result->getAttributes();
// $result->getId();
// $result->getReference();