Exemplo n.º 1
0
 public static function init($config, $soap_enabled = true)
 {
     self::$config = $config;
     self::$api = new SoapClient(NULL, array('location' => self::$config['URL'], 'uri' => self::$config['URL'], 'trace' => 1, 'cache_wsdl' => WSDL_CACHE_NONE));
     if ($soap_enabled) {
         $r = self::$api->auth(self::$config['CLIENT_ID'], self::$config['CLAPI_KEY'], NULL);
         if (is_object($r)) {
             $r = (array) $r;
         }
         if ($r['status']) {
             throw new Exception("Cannot authenticate");
         }
     }
 }
Exemplo n.º 2
0
<?php

require_once 'RecognizeImAPI.php';
//RecognizeImAPI::imageDelete(); die;
$imagePath = 'test.jpg';
$mode = 'single';
if (RecognizeImAPI::checkImageLimits($imagePath, $mode)) {
    $singleOneResult = RecognizeImAPI::recognize(file_get_contents($imagePath), $mode);
    $singleAllResults = RecognizeImAPI::recognize(file_get_contents($imagePath), $mode, TRUE);
    echo $singleOneResult, "\n", $singleAllResults, "\n";
    if ($singleOneResult->isOK()) {
        $im = $singleOneResult->drawFrames(file_get_contents($imagePath));
        file_put_contents('frames.jpg', $im);
    }
} else {
    echo "Image does not fulfill the requirements.\n";
}
//$imageList = RecognizeImAPI::imageList();