1. Go to this page and download the library: Download jordikroon/google-vision 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/ */
jordikroon / google-vision example snippets
$vision = new \Vision\Vision(
$apiKey,
[
// See a list of all features in the table below
// Feature, Limit
new \Vision\Feature(\Vision\Feature::FACE_DETECTION, 100),
]
);
$imagePath = $_FILES['file']['tmp_name'];
$response = $vision->request(
// See a list of all image loaders in the table below
new \Vision\Request\Image\LocalImage($imagePath)
);
$faces = $response->getFaceAnnotations();
foreach ($faces as $face) {
foreach ($face->getBoundingPoly()->getVertices() as $vertex) {
echo sprintf('Person at position X %f and Y %f', $vertex->getX(), $vertex->getY());
}
}
new \Vision\Feature($feature, $maxResults);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.