17 lines
555 B
PHP
17 lines
555 B
PHP
<?php
|
|
|
|
use App\Kernel;
|
|
use jucksearm\barcode\Datamatrix;
|
|
|
|
Kernel::app()->get('/{code}', function ($request, $response, $args) {
|
|
$image = @Datamatrix::factory()
|
|
->setSize(300)
|
|
->setMargin(6)
|
|
->setCode($args['code'])->getDatamatrixPngData();
|
|
$body = $response->getBody();
|
|
$body->write($image);
|
|
$response = $response->withHeader("Content-type", 'image/png');
|
|
$response = $response->withHeader("Cache-Control", 'no-cache');
|
|
$response = $response->withHeader("Last-Modified", gmdate('D, d M Y H:i:s') . ' GMT');
|
|
return $response;
|
|
});
|