2017 © Pedro Peláez
 

library lmfa

This Package Help You to connect to Microsoft Face APi.

image

ikosar/lmfa

This Package Help You to connect to Microsoft Face APi.

  • Tuesday, May 1, 2018
  • by ikosar
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

LMFA

This Package Help You To Connect To Microsoft Face APi by Mohammad Najafian, (*1)

Installation

install With Composer

 composer require ikosar/lmfa 
 ```
#### After : 

```php
 php artisan vendor:publish 
 ```
 # Config
 Open ``` lmfa.php ``` in config folder in laravel root then you can enter you'r ``` api_key ``` in this file !
 # Usage 
 ## Normal Request  (Return To You Face's info)
 ### 1 .  First we need to do this  :100: :  
 ```php
  $face = new CheckFace();
 ```
 ### 2 .  We Set The Url : 
  if you want to customize the url , Do this :100: : (default : https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect)
  ```php
    $face->setUrl($url);
  ```
 ### 3 .  Also Set Request Type ( post , get , delete , put ) :100: : 
  To this step we set the request's type (only lowercase) : 
  ```php
    $face->setMethod("post");
  ```
 ### 4 .  Set Headers :100: : 
  We Must to set headers to use Microsoft's Face APi (only lowercase) : 
  ##### if you want to put APi_key in Headers or Parameters Use This :
  ```php
    $face->getApiKey();
  ```
  ```php
    $face->setHeaders(array(
       'Content-Type' => 'application/json',
       'Ocp-Apim-Subscription-Key' => $face->getApiKey(),
    ));
  ```
   ### 5 .  Set Parameters :100: : 
To this step we can set the Parameters :
```php
  $face->setParameters(array(
      'returnFaceId' => 'true', // Recommended : True 
      'returnFaceLandmarks' => 'false', // Very information about face sizes
      'returnFaceAttributes' => 'age,gender,glasses,smile,noise,hair,accessories,emotion,makeup', // Your Requsted info
  ));

You can set these in the returnFaceAttributes in parameters Some Face Attributes : age , gender , glasses , smile , noise , hair , accessories , emotion , makeup ... //, (*2)

6 . Set image :100: :

Then , we need to set image :-) : We must to put image URL in the array Like This., (*3)

  $image = array(
      'url' => 'http://cdn-tehran.wisgoon.com/dlir-s3/10531466806488528869.JPG',
  );
  $face->setBody($image,true); // Set Image

7 . Check Request to complete seted :100: :

We must to Check Before $face->send()., (*4)

         $face->check();
         $face->send();        

8 . Get Face Information in JSON :100: :

Do This :, (*5)

         $face->check();
         $result = $face->send();
         // Now JSON in $result  
         return $result;      

Finish And a Example:

php $image = array( 'url' => 'https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Donald_Trump_August_19%2C_2015_%28cropped%29.jpg/245px-Donald_Trump_August_19%2C_2015_%28cropped%29.jpg', ); $url = "http://..."; $face = new CheckFace(); $face->setUrl($url); $face->setImage($image); $face->setMethod("post"); $face->setHeaders(array( 'Content-Type' => 'application/json', 'Ocp-Apim-Subscription-Key' => $face->getApiKey(), )); $face->setParameters(array( 'returnFaceId' => 'true', 'returnFaceLandmarks' => 'false', 'returnFaceAttributes' => 'age,gender,glasses,smile,noise,hair,accessories,emotion,makeup', )); $face->setBody($image); $face->check(); $result = $face->send();, (*6)

Licence

This Project is under the MIT Licence

Read About Microsoft Face Api

Types of requests

https://westcentralus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236

The Versions

01/05 2018

dev-master

9999999-dev

This Package Help You to connect to Microsoft Face APi.

  Sources   Download

MIT

The Requires

 

by Avatar ikosar

01/05 2018

1

1.0.0.0

This Package Help You to connect to Microsoft Face APi.

  Sources   Download

MIT

The Requires

 

by Avatar ikosar