-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
30 lines (23 loc) · 1019 Bytes
/
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
<?php
declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
use Aspose\BarCode\Configuration;
use Aspose\BarCode\GenerateApi;
use Aspose\BarCode\Requests\GenerateRequestWrapper;
use Aspose\BarCode\Model\{EncodeBarcodeType, EncodeDataType, CodeLocation, BarcodeImageFormat};
$config = new Configuration();
$config->setClientId('ClientId from https://dashboard.aspose.cloud/applications');
$config->setClientSecret('Client Secret from https://dashboard.aspose.cloud/applications');
if (getenv("TEST_CONFIGURATION_ACCESS_TOKEN")) {
$config->setAccessToken(getenv("TEST_CONFIGURATION_ACCESS_TOKEN"));
}
$request = new GenerateRequestWrapper(EncodeBarcodeType::QR, 'PHP SDK Test');
$request->image_format = BarcodeImageFormat::Png;
$request->text_location = CodeLocation::None;
$api = new GenerateApi(null, $config);
$response = $api->generate($request);
$type = 'image/png';
$size = $response->getSize();
header("Content-Type: $type");
header("Content-Length: $size");
echo $response->fread($size);