-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
48 lines (36 loc) · 1.16 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
* Header que será utilizado.
*/
header("Content-Type: image/jpeg");
/*
* Obtendo o Path principal
*/
$MainPath = realpath(dirname(dirname(dirname(__FILE__))));
// Incluindo arquivo correspondente a classe.
require_once($MainPath . '\core\settings.php');
require_once($MainPath . '\core\GenerateThumbnail.php');
/*
* Imagem que será utilizada.
*/
$imageUrl = 'https://www.sketchappsources.com/resources/source-image/windows-logo-alesiamjau.png';
// Localizações da requisição
$RequestLocation = CVA_API_LOCATION_ARRAY;
// Usar header principal?
$useMainHeader = True;
// Instanciando classe...
$Thumbnail = new \rqdev\packages\ComputerVisionAPI\GenerateThumbnail();
$Sucess = $Thumbnail
->setAPILocation($RequestLocation[2])
->setHeight(600)
->setWidth(600)
->setSmartCropping(true)
->send($imageUrl, $useMainHeader);
if ($Sucess) {
$base64Image = $Thumbnail->getResponse()::toBase64();
$htmlElement = $Thumbnail->getResponse()::getHtml();
$imageProperties = $Thumbnail->getResponse()::ImageDetails();
echo $Thumbnail->getResponse()->getImageBinary();
} else {
var_dump($Thumbnail->error);
}