ldc-pfcgen/app/Routes/web.php
Jérémy Munsch f5fdef3755 First draw
2021-01-29 12:54:43 +01:00

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;
});