autofixes

This commit is contained in:
Dennis Eichhorn 2023-08-30 12:08:10 +00:00
parent 7ae1545978
commit 57d83ba9d9
13 changed files with 248 additions and 239 deletions

View File

@ -14,7 +14,6 @@ declare(strict_types=1);
namespace Modules\Labeling\Admin\Install; namespace Modules\Labeling\Admin\Install;
use Modules\Labeling\Models\SettingsEnum;
use phpOMS\Application\ApplicationAbstract; use phpOMS\Application\ApplicationAbstract;
/** /**

View File

@ -1,9 +1,9 @@
<?php <?php declare(strict_types=1);
use Modules\Labeling\Models\Label;
use Modules\Labeling\Models\Text;
use Modules\Labeling\Models\Shape;
use Modules\Labeling\Models\Image; use Modules\Labeling\Models\Image;
use Modules\Labeling\Models\Label;
use Modules\Labeling\Models\Shape;
use Modules\Labeling\Models\Text;
use phpOMS\Utils\Barcode\Datamatrix; use phpOMS\Utils\Barcode\Datamatrix;
use phpOMS\Utils\Barcode\QR; use phpOMS\Utils\Barcode\QR;
@ -12,233 +12,233 @@ $margin = 50;
$l = new Label(); $l = new Label();
// top // top
$text = new Text(); $text = new Text();
$text->text = $item->getL11n('name1')->content; $text->text = $item->getL11n('name1')->content;
$text->size = 80; $text->size = 80;
$text->x = $margin; $text->x = $margin;
$text->y = 80 + $margin; $text->y = 80 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
// sub // sub
$text = new Text(); $text = new Text();
$text->text = $item->getL11n('name2')->content; $text->text = $item->getL11n('name2')->content;
$text->size = 50; $text->size = 50;
$text->x = $margin; $text->x = $margin;
$text->y = 170 + $margin; $text->y = 170 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
$line = new Shape(); $line = new Shape();
$line->type = 1; $line->type = 1;
$line->borderThickness = 5; $line->borderThickness = 5;
$line->x = $margin; $line->x = $margin;
$line->y = 200 + $margin; $line->y = 200 + $margin;
$line->x2 = (int) ((37.8 * $l->width) - $margin); $line->x2 = (int) ((37.8 * $l->width) - $margin);
$line->y2 = $line->y; $line->y2 = $line->y;
$l->elements[] = $line; $l->elements[] = $line;
// facts // facts
// REF // REF
$image = new Image(); $image = new Image();
$image->src = '/Modules/Labeling/Theme/icons/iso/2493.png'; $image->src = '/Modules/Labeling/Theme/icons/iso/2493.png';
$image->x = $margin - 15; $image->x = $margin - 15;
$image->y = 250 + $margin - 50; $image->y = 250 + $margin - 50;
$image->x2 = $image->x + 150; $image->x2 = $image->x + 150;
$image->y2 = 75 + $image->y; $image->y2 = 75 + $image->y;
$l->elements[] = $image; $l->elements[] = $image;
$text = new Text(); $text = new Text();
$text->text = '0123-4567-8910'; $text->text = '0123-4567-8910';
$text->size = 40; $text->size = 40;
$text->x = 150 + $margin; $text->x = 150 + $margin;
$text->y = 290 + $margin; $text->y = 290 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
// LOT // LOT
$image = new Image(); $image = new Image();
$image->src = '/Modules/Labeling/Theme/icons/iso/2492.png'; $image->src = '/Modules/Labeling/Theme/icons/iso/2492.png';
$image->x = $margin - 15; $image->x = $margin - 15;
$image->y = 350 + $margin - 50; $image->y = 350 + $margin - 50;
$image->x2 = $image->x + 150; $image->x2 = $image->x + 150;
$image->y2 = 75 + $image->y; $image->y2 = 75 + $image->y;
$l->elements[] = $image; $l->elements[] = $image;
$text = new Text(); $text = new Text();
$text->text = '0123-4567-8910'; $text->text = '0123-4567-8910';
$text->size = 40; $text->size = 40;
$text->x = 150 + $margin; $text->x = 150 + $margin;
$text->y = 390 + $margin; $text->y = 390 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
// SN // SN
$image = new Image(); $image = new Image();
$image->src = '/Modules/Labeling/Theme/icons/iso/2498.png'; $image->src = '/Modules/Labeling/Theme/icons/iso/2498.png';
$image->x = $margin - 15; $image->x = $margin - 15;
$image->y = 450 + $margin - 50; $image->y = 450 + $margin - 50;
$image->x2 = $image->x + 150; $image->x2 = $image->x + 150;
$image->y2 = 75 + $image->y; $image->y2 = 75 + $image->y;
$l->elements[] = $image; $l->elements[] = $image;
$text = new Text(); $text = new Text();
$text->text = '0123-4567-8910'; $text->text = '0123-4567-8910';
$text->size = 40; $text->size = 40;
$text->x = 150 + $margin; $text->x = 150 + $margin;
$text->y = 490 + $margin; $text->y = 490 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
// manufactured // manufactured
$image = new Image(); $image = new Image();
$image->src = '/Modules/Labeling/Theme/icons/iso/2497.png'; $image->src = '/Modules/Labeling/Theme/icons/iso/2497.png';
$image->x = $margin - 15; $image->x = $margin - 15;
$image->y = 560 + $margin - 50; $image->y = 560 + $margin - 50;
$image->x2 = $image->x + 150; $image->x2 = $image->x + 150;
$image->y2 = 75 + $image->y; $image->y2 = 75 + $image->y;
$l->elements[] = $image; $l->elements[] = $image;
$text = new Text(); $text = new Text();
$text->text = 'YYYY-MM-DD'; $text->text = 'YYYY-MM-DD';
$text->size = 40; $text->size = 40;
$text->x = 150 + $margin; $text->x = 150 + $margin;
$text->y = 610 + $margin; $text->y = 610 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
$text = new Text(); $text = new Text();
$text->text = 'DE'; $text->text = 'DE';
$text->size = 20; $text->size = 20;
$text->x = $margin + 40; $text->x = $margin + 40;
$text->y = 625 + $margin; $text->y = 625 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
// use by date // use by date
$image = new Image(); $image = new Image();
$image->src = '/Modules/Labeling/Theme/icons/iso/2607.png'; $image->src = '/Modules/Labeling/Theme/icons/iso/2607.png';
$image->x = $margin + 500; $image->x = $margin + 500;
$image->y = 540 + $margin; $image->y = 540 + $margin;
$image->x2 = $image->x + 100; $image->x2 = $image->x + 100;
$image->y2 = 75 + $image->y; $image->y2 = 75 + $image->y;
$l->elements[] = $image; $l->elements[] = $image;
$text = new Text(); $text = new Text();
$text->text = 'YYYY-MM-DD'; $text->text = 'YYYY-MM-DD';
$text->size = 40; $text->size = 40;
$text->x = 600 + $margin; $text->x = 600 + $margin;
$text->y = 610 + $margin; $text->y = 610 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
// QR // QR
$qr = new Datamatrix('https://jingga.app', 200, 200); $qr = new Datamatrix('https://jingga.app', 200, 200);
$image = new Image(); $image = new Image();
$image->resource = $qr->get(); $image->resource = $qr->get();
$image->x = 1000 + $margin; $image->x = 1000 + $margin;
$image->y = 280 + $margin - 50; $image->y = 280 + $margin - 50;
$image->x2 = $image->x + 200; $image->x2 = $image->x + 200;
$image->y2 = 75 + $image->y; $image->y2 = 75 + $image->y;
$l->elements[] = $image; $l->elements[] = $image;
$text = new Text(); $text = new Text();
$text->text = "(01)00000000000000\n(11)000000\n(17)000000\n(10)A000B0\n(21)0000"; $text->text = "(01)00000000000000\n(11)000000\n(17)000000\n(10)A000B0\n(21)0000";
$text->size = 40; $text->size = 40;
$text->x = 1230 + $margin; $text->x = 1230 + $margin;
$text->y = 280 + $margin; $text->y = 280 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
// Footer // Footer
// line // line
$line = new Shape(); $line = new Shape();
$line->type = 1; $line->type = 1;
$line->borderThickness = 5; $line->borderThickness = 5;
$line->x = $margin; $line->x = $margin;
$line->y = 660 + $margin; $line->y = 660 + $margin;
$line->x2 = (int) ((37.8 * $l->width) - $margin); $line->x2 = (int) ((37.8 * $l->width) - $margin);
$line->y2 = $line->y; $line->y2 = $line->y;
$l->elements[] = $line; $l->elements[] = $line;
// manufacturer // manufacturer
$image = new Image(); $image = new Image();
$image->src = '/Modules/Labeling/Theme/icons/iso/3082.png'; $image->src = '/Modules/Labeling/Theme/icons/iso/3082.png';
$image->x = $margin - 15; $image->x = $margin - 15;
$image->y = 660 + $margin; $image->y = 660 + $margin;
$image->x2 = $image->x + 150; $image->x2 = $image->x + 150;
$image->y2 = 75 + $image->y; $image->y2 = 75 + $image->y;
$l->elements[] = $image; $l->elements[] = $image;
// address // address
$text = new Text(); $text = new Text();
$text->text = 'Jingga e. K.'; $text->text = 'Jingga e. K.';
$text->size = 30; $text->size = 30;
$text->x = 150 + $margin; $text->x = 150 + $margin;
$text->y = 710 + $margin; $text->y = 710 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
$text = new Text(); $text = new Text();
$text->text = 'Kirchstr. 33'; $text->text = 'Kirchstr. 33';
$text->size = 30; $text->size = 30;
$text->x = 150 + $margin; $text->x = 150 + $margin;
$text->y = 760 + $margin; $text->y = 760 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
$text = new Text(); $text = new Text();
$text->text = '61191 Rosbach'; $text->text = '61191 Rosbach';
$text->size = 30; $text->size = 30;
$text->x = 150 + $margin; $text->x = 150 + $margin;
$text->y = 810 + $margin; $text->y = 810 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
$text = new Text(); $text = new Text();
$text->text = 'Germany'; $text->text = 'Germany';
$text->size = 30; $text->size = 30;
$text->x = 150 + $margin; $text->x = 150 + $margin;
$text->y = 860 + $margin; $text->y = 860 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
// contact // contact
$text = new Text(); $text = new Text();
$text->text = 'www.jingga.app'; $text->text = 'www.jingga.app';
$text->size = 30; $text->size = 30;
$text->x = 600 + $margin; $text->x = 600 + $margin;
$text->y = 710 + $margin; $text->y = 710 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
$text = new Text(); $text = new Text();
$text->text = 'info@jingga.app'; $text->text = 'info@jingga.app';
$text->size = 30; $text->size = 30;
$text->x = 600 + $margin; $text->x = 600 + $margin;
$text->y = 760 + $margin; $text->y = 760 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
$text = new Text(); $text = new Text();
$text->text = '+49 0123 456789'; $text->text = '+49 0123 456789';
$text->size = 30; $text->size = 30;
$text->x = 600 + $margin; $text->x = 600 + $margin;
$text->y = 810 + $margin; $text->y = 810 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
// ce // ce
$image = new Image(); $image = new Image();
$image->src = '/Modules/Labeling/Theme/icons/iso/ce_mark.png'; $image->src = '/Modules/Labeling/Theme/icons/iso/ce_mark.png';
$image->x = 1400 + $margin; $image->x = 1400 + $margin;
$image->y = 680 + $margin; $image->y = 680 + $margin;
$image->x2 = $image->x + 200; $image->x2 = $image->x + 200;
$image->y2 = 200 + $image->y; $image->y2 = 200 + $image->y;
$l->elements[] = $image; $l->elements[] = $image;
$text = new Text(); $text = new Text();
$text->text = '0123'; $text->text = '0123';
$text->size = 45; $text->size = 45;
$text->x = 1430 + $margin; $text->x = 1430 + $margin;
$text->y = 850 + $margin; $text->y = 850 + $margin;
$l->elements[] = $text; $l->elements[] = $text;
// qr // qr
$qr = new QR('https://jingga.app', 200, 200); $qr = new QR('https://jingga.app', 200, 200);
$image = new Image(); $image = new Image();
$image->resource = $qr->get(); $image->resource = $qr->get();
$image->x = 1620 + $margin; $image->x = 1620 + $margin;
$image->y = 680 + $margin; $image->y = 680 + $margin;
$image->x2 = $image->x + 180; $image->x2 = $image->x + 180;
$image->y2 = 180 + $image->y; $image->y2 = 180 + $image->y;
$l->elements[] = $image; $l->elements[] = $image;
return $l; return $l;

View File

@ -20,9 +20,7 @@ use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse; use phpOMS\Message\Http\HttpResponse;
use phpOMS\Module\InstallerAbstract; use phpOMS\Module\InstallerAbstract;
use phpOMS\Module\ModuleInfo; use phpOMS\Module\ModuleInfo;
use phpOMS\System\MimeType;
use phpOMS\Uri\HttpUri; use phpOMS\Uri\HttpUri;
use phpOMS\Utils\TestUtils;
/** /**
* Installer class. * Installer class.
@ -67,7 +65,7 @@ final class Installer extends InstallerAbstract
/** /**
* Install default bill types * Install default bill types
* *
* @param ApplicationAbstract $app Application * @param ApplicationAbstract $app Application
* @param array $layouts Default layouts * @param array $layouts Default layouts
* *
* @return array * @return array

View File

@ -16,9 +16,9 @@ declare(strict_types=1);
namespace Modules\Labeling\Controller; namespace Modules\Labeling\Controller;
use Modules\Labeling\Models\LabelLayoutMapper;
use Modules\Labeling\Models\LabelLayout; use Modules\Labeling\Models\LabelLayout;
use Modules\Labeling\Models\LabelLayoutL11nMapper; use Modules\Labeling\Models\LabelLayoutL11nMapper;
use Modules\Labeling\Models\LabelLayoutMapper;
use Modules\Media\Models\CollectionMapper; use Modules\Media\Models\CollectionMapper;
use phpOMS\Localization\BaseStringL11n; use phpOMS\Localization\BaseStringL11n;
use phpOMS\Localization\ISO639x1Enum; use phpOMS\Localization\ISO639x1Enum;
@ -97,7 +97,7 @@ final class ApiController extends Controller
$labelLayout = new LabelLayout(); $labelLayout = new LabelLayout();
$labelLayout->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN); $labelLayout->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN);
$path = '/Modules/Labeling/Templates/' . $request->getDataString('title'); $path = '/Modules/Labeling/Templates/' . $request->getDataString('title');
$uploadedFiles = $request->files; $uploadedFiles = $request->files;
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles( $uploaded = $this->app->moduleManager->get('Media')->uploadFiles(

View File

@ -19,30 +19,30 @@ namespace Modules\Labeling\Models\Guidelines;
class GS1Datamatrix class GS1Datamatrix
{ {
private const DEFINITIONS = [ private const DEFINITIONS = [
'00' => ['title' => 'SSCC', 'FNC1' => false, 'pattern' => '^00(\d{18})$',], '00' => ['title' => 'SSCC', 'FNC1' => false, 'pattern' => '^00(\d{18})$',],
'01' => ['title' => 'GTIN', 'FNC1' => false, 'pattern' => '^01(\d{14})$',], '01' => ['title' => 'GTIN', 'FNC1' => false, 'pattern' => '^01(\d{14})$',],
'02' => ['title' => 'CONTENT', 'FNC1' => false, 'pattern' => '^02(\d{14})$',], '02' => ['title' => 'CONTENT', 'FNC1' => false, 'pattern' => '^02(\d{14})$',],
'10' => ['title' => 'BATCH/LOT', 'FNC1' => true, 'pattern' => '^10([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '10' => ['title' => 'BATCH/LOT', 'FNC1' => true, 'pattern' => '^10([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'11' => ['title' => 'PROD DATE', 'FNC1' => false, 'pattern' => '^11(\d{6})$',], '11' => ['title' => 'PROD DATE', 'FNC1' => false, 'pattern' => '^11(\d{6})$',],
'12' => ['title' => 'DUE DATE', 'FNC1' => false, 'pattern' => '^12(\d{6})$',], '12' => ['title' => 'DUE DATE', 'FNC1' => false, 'pattern' => '^12(\d{6})$',],
'13' => ['title' => 'PACK DATE', 'FNC1' => false, 'pattern' => '^13(\d{6})$',], '13' => ['title' => 'PACK DATE', 'FNC1' => false, 'pattern' => '^13(\d{6})$',],
'15' => ['title' => 'BEST BEFORE or BEST BY', 'FNC1' => false, 'pattern' => '^15(\d{6})$',], '15' => ['title' => 'BEST BEFORE or BEST BY', 'FNC1' => false, 'pattern' => '^15(\d{6})$',],
'16' => ['title' => 'SELL BY', 'FNC1' => false, 'pattern' => '^16(\d{6})$',], '16' => ['title' => 'SELL BY', 'FNC1' => false, 'pattern' => '^16(\d{6})$',],
'17' => ['title' => 'USE BY OR EXPIRY', 'FNC1' => false, 'pattern' => '^17(\d{6})$',], '17' => ['title' => 'USE BY OR EXPIRY', 'FNC1' => false, 'pattern' => '^17(\d{6})$',],
'20' => ['title' => 'VARIANT', 'FNC1' => false, 'pattern' => '^20(\d{2})$',], '20' => ['title' => 'VARIANT', 'FNC1' => false, 'pattern' => '^20(\d{2})$',],
'21' => ['title' => 'SERIAL', 'FNC1' => true, 'pattern' => '^21([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '21' => ['title' => 'SERIAL', 'FNC1' => true, 'pattern' => '^21([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'22' => ['title' => 'CPV', 'FNC1' => true, 'pattern' => '^22([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '22' => ['title' => 'CPV', 'FNC1' => true, 'pattern' => '^22([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'235' => ['title' => 'TPX', 'FNC1' => true, 'pattern' => '^235([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,28})$',], '235' => ['title' => 'TPX', 'FNC1' => true, 'pattern' => '^235([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,28})$',],
'240' => ['title' => 'ADDITIONAL ID', 'FNC1' => true, 'pattern' => '^240([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], '240' => ['title' => 'ADDITIONAL ID', 'FNC1' => true, 'pattern' => '^240([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',],
'241' => ['title' => 'CUST. PART No.', 'FNC1' => true, 'pattern' => '^241([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], '241' => ['title' => 'CUST. PART No.', 'FNC1' => true, 'pattern' => '^241([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',],
'242' => ['title' => 'MTO VARIANT', 'FNC1' => true, 'pattern' => '^242(\d{0,6})$',], '242' => ['title' => 'MTO VARIANT', 'FNC1' => true, 'pattern' => '^242(\d{0,6})$',],
'243' => ['title' => 'PCN', 'FNC1' => true, 'pattern' => '^243([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '243' => ['title' => 'PCN', 'FNC1' => true, 'pattern' => '^243([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'250' => ['title' => 'SECONDARY SERIAL', 'FNC1' => true, 'pattern' => '^250([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], '250' => ['title' => 'SECONDARY SERIAL', 'FNC1' => true, 'pattern' => '^250([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',],
'251' => ['title' => 'REF. TO SOURCE', 'FNC1' => true, 'pattern' => '^251([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], '251' => ['title' => 'REF. TO SOURCE', 'FNC1' => true, 'pattern' => '^251([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',],
'253' => ['title' => 'GDTI', 'FNC1' => true, 'pattern' => '^253(\d{13})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,17})$',], '253' => ['title' => 'GDTI', 'FNC1' => true, 'pattern' => '^253(\d{13})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,17})$',],
'254' => ['title' => 'GLN EXTENSION COMPONENT', 'FNC1' => true, 'pattern' => '^254([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '254' => ['title' => 'GLN EXTENSION COMPONENT', 'FNC1' => true, 'pattern' => '^254([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'255' => ['title' => 'GCN', 'FNC1' => true, 'pattern' => '^255(\d{13})(\d{0,12})$',], '255' => ['title' => 'GCN', 'FNC1' => true, 'pattern' => '^255(\d{13})(\d{0,12})$',],
'30' => ['title' => 'VAR. COUNT', 'FNC1' => true, 'pattern' => '^30(\d{0,8})$',], '30' => ['title' => 'VAR. COUNT', 'FNC1' => true, 'pattern' => '^30(\d{0,8})$',],
'3100' => ['title' => 'NET WEIGHT (kg)', 'FNC1' => false, 'pattern' => '^3100(\d{6})$',], '3100' => ['title' => 'NET WEIGHT (kg)', 'FNC1' => false, 'pattern' => '^3100(\d{6})$',],
'3101' => ['title' => 'NET WEIGHT (kg)', 'FNC1' => false, 'pattern' => '^3101(\d{6})$',], '3101' => ['title' => 'NET WEIGHT (kg)', 'FNC1' => false, 'pattern' => '^3101(\d{6})$',],
'3102' => ['title' => 'NET WEIGHT (kg)', 'FNC1' => false, 'pattern' => '^3102(\d{6})$',], '3102' => ['title' => 'NET WEIGHT (kg)', 'FNC1' => false, 'pattern' => '^3102(\d{6})$',],
@ -361,7 +361,7 @@ class GS1Datamatrix
'3693' => ['title' => 'VOLUME (yd<sup>3</sup>), log', 'FNC1' => false, 'pattern' => '^3693(\d{6})$',], '3693' => ['title' => 'VOLUME (yd<sup>3</sup>), log', 'FNC1' => false, 'pattern' => '^3693(\d{6})$',],
'3694' => ['title' => 'VOLUME (yd<sup>3</sup>), log', 'FNC1' => false, 'pattern' => '^3694(\d{6})$',], '3694' => ['title' => 'VOLUME (yd<sup>3</sup>), log', 'FNC1' => false, 'pattern' => '^3694(\d{6})$',],
'3695' => ['title' => 'VOLUME (yd<sup>3</sup>), log', 'FNC1' => false, 'pattern' => '^3695(\d{6})$',], '3695' => ['title' => 'VOLUME (yd<sup>3</sup>), log', 'FNC1' => false, 'pattern' => '^3695(\d{6})$',],
'37' => ['title' => 'COUNT', 'FNC1' => true, 'pattern' => '^37(\d{0,8})$',], '37' => ['title' => 'COUNT', 'FNC1' => true, 'pattern' => '^37(\d{0,8})$',],
'3900' => ['title' => 'AMOUNT', 'FNC1' => true, 'pattern' => '^3900(\d{0,15})$',], '3900' => ['title' => 'AMOUNT', 'FNC1' => true, 'pattern' => '^3900(\d{0,15})$',],
'3901' => ['title' => 'AMOUNT', 'FNC1' => true, 'pattern' => '^3901(\d{0,15})$',], '3901' => ['title' => 'AMOUNT', 'FNC1' => true, 'pattern' => '^3901(\d{0,15})$',],
'3902' => ['title' => 'AMOUNT', 'FNC1' => true, 'pattern' => '^3902(\d{0,15})$',], '3902' => ['title' => 'AMOUNT', 'FNC1' => true, 'pattern' => '^3902(\d{0,15})$',],
@ -416,26 +416,26 @@ class GS1Datamatrix
'3957' => ['title' => 'PRICE/UoM', 'FNC1' => true, 'pattern' => '^3957(\d{0,6})$',], '3957' => ['title' => 'PRICE/UoM', 'FNC1' => true, 'pattern' => '^3957(\d{0,6})$',],
'3958' => ['title' => 'PRICE/UoM', 'FNC1' => true, 'pattern' => '^3958(\d{0,6})$',], '3958' => ['title' => 'PRICE/UoM', 'FNC1' => true, 'pattern' => '^3958(\d{0,6})$',],
'3959' => ['title' => 'PRICE/UoM', 'FNC1' => true, 'pattern' => '^3959(\d{0,6})$',], '3959' => ['title' => 'PRICE/UoM', 'FNC1' => true, 'pattern' => '^3959(\d{0,6})$',],
'400' => ['title' => 'ORDER NUMBER', 'FNC1' => true, 'pattern' => '^400([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], '400' => ['title' => 'ORDER NUMBER', 'FNC1' => true, 'pattern' => '^400([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',],
'401' => ['title' => 'GINC', 'FNC1' => true, 'pattern' => '^401([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], '401' => ['title' => 'GINC', 'FNC1' => true, 'pattern' => '^401([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',],
'402' => ['title' => 'GSIN', 'FNC1' => true, 'pattern' => '^402(\d{17})$',], '402' => ['title' => 'GSIN', 'FNC1' => true, 'pattern' => '^402(\d{17})$',],
'403' => ['title' => 'ROUTE', 'FNC1' => true, 'pattern' => '^403([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], '403' => ['title' => 'ROUTE', 'FNC1' => true, 'pattern' => '^403([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',],
'410' => ['title' => 'SHIP TO LOC', 'FNC1' => false, 'pattern' => '^410(\d{13})$',], '410' => ['title' => 'SHIP TO LOC', 'FNC1' => false, 'pattern' => '^410(\d{13})$',],
'411' => ['title' => 'BILL TO', 'FNC1' => false, 'pattern' => '^411(\d{13})$',], '411' => ['title' => 'BILL TO', 'FNC1' => false, 'pattern' => '^411(\d{13})$',],
'412' => ['title' => 'PURCHASE FROM', 'FNC1' => false, 'pattern' => '^412(\d{13})$',], '412' => ['title' => 'PURCHASE FROM', 'FNC1' => false, 'pattern' => '^412(\d{13})$',],
'413' => ['title' => 'SHIP FOR LOC', 'FNC1' => false, 'pattern' => '^413(\d{13})$',], '413' => ['title' => 'SHIP FOR LOC', 'FNC1' => false, 'pattern' => '^413(\d{13})$',],
'414' => ['title' => 'LOC No.', 'FNC1' => false, 'pattern' => '^414(\d{13})$',], '414' => ['title' => 'LOC No.', 'FNC1' => false, 'pattern' => '^414(\d{13})$',],
'415' => ['title' => 'PAY TO', 'FNC1' => false, 'pattern' => '^415(\d{13})$',], '415' => ['title' => 'PAY TO', 'FNC1' => false, 'pattern' => '^415(\d{13})$',],
'416' => ['title' => 'PROD/SERV LOC', 'FNC1' => false, 'pattern' => '^416(\d{13})$',], '416' => ['title' => 'PROD/SERV LOC', 'FNC1' => false, 'pattern' => '^416(\d{13})$',],
'417' => ['title' => 'PARTY', 'FNC1' => false, 'pattern' => '^417(\d{13})$',], '417' => ['title' => 'PARTY', 'FNC1' => false, 'pattern' => '^417(\d{13})$',],
'420' => ['title' => 'SHIP TO POST', 'FNC1' => true, 'pattern' => '^420([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '420' => ['title' => 'SHIP TO POST', 'FNC1' => true, 'pattern' => '^420([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'421' => ['title' => 'SHIP TO POST', 'FNC1' => true, 'pattern' => '^421(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,9})$',], '421' => ['title' => 'SHIP TO POST', 'FNC1' => true, 'pattern' => '^421(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,9})$',],
'422' => ['title' => 'ORIGIN', 'FNC1' => true, 'pattern' => '^422(\d{3})$',], '422' => ['title' => 'ORIGIN', 'FNC1' => true, 'pattern' => '^422(\d{3})$',],
'423' => ['title' => 'COUNTRY - INITIAL PROCESS', 'FNC1' => true, 'pattern' => '^423(\d{3})(\d{0,12})$',], '423' => ['title' => 'COUNTRY - INITIAL PROCESS', 'FNC1' => true, 'pattern' => '^423(\d{3})(\d{0,12})$',],
'424' => ['title' => 'COUNTRY - PROCESS', 'FNC1' => true, 'pattern' => '^424(\d{3})$',], '424' => ['title' => 'COUNTRY - PROCESS', 'FNC1' => true, 'pattern' => '^424(\d{3})$',],
'425' => ['title' => 'COUNTRY - DISASSEMBLY', 'FNC1' => true, 'pattern' => '^425(\d{3})(\d{0,12})$',], '425' => ['title' => 'COUNTRY - DISASSEMBLY', 'FNC1' => true, 'pattern' => '^425(\d{3})(\d{0,12})$',],
'426' => ['title' => 'COUNTRY - FULL PROCESS', 'FNC1' => true, 'pattern' => '^426(\d{3})$',], '426' => ['title' => 'COUNTRY - FULL PROCESS', 'FNC1' => true, 'pattern' => '^426(\d{3})$',],
'427' => ['title' => 'ORIGIN SUBDIVISION', 'FNC1' => true, 'pattern' => '^427([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,3})$',], '427' => ['title' => 'ORIGIN SUBDIVISION', 'FNC1' => true, 'pattern' => '^427([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,3})$',],
'4300' => ['title' => 'SHIP TO COMP', 'FNC1' => true, 'pattern' => '^4300([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,35})$',], '4300' => ['title' => 'SHIP TO COMP', 'FNC1' => true, 'pattern' => '^4300([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,35})$',],
'4301' => ['title' => 'SHIP TO NAME', 'FNC1' => true, 'pattern' => '^4301([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,35})$',], '4301' => ['title' => 'SHIP TO NAME', 'FNC1' => true, 'pattern' => '^4301([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,35})$',],
'4302' => ['title' => 'SHIP TO ADD1', 'FNC1' => true, 'pattern' => '^4302([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,70})$',], '4302' => ['title' => 'SHIP TO ADD1', 'FNC1' => true, 'pattern' => '^4302([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,70})$',],
@ -489,12 +489,12 @@ class GS1Datamatrix
'7038' => ['title' => 'PROCESSOR # 8', 'FNC1' => true, 'pattern' => '^7038(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,27})$',], '7038' => ['title' => 'PROCESSOR # 8', 'FNC1' => true, 'pattern' => '^7038(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,27})$',],
'7039' => ['title' => 'PROCESSOR # 9', 'FNC1' => true, 'pattern' => '^7039(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,27})$',], '7039' => ['title' => 'PROCESSOR # 9', 'FNC1' => true, 'pattern' => '^7039(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,27})$',],
'7040' => ['title' => 'UIC+EXT', 'FNC1' => true, 'pattern' => '^7040(\d[\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{3})$',], '7040' => ['title' => 'UIC+EXT', 'FNC1' => true, 'pattern' => '^7040(\d[\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{3})$',],
'710' => ['title' => 'NHRN PZN', 'FNC1' => true, 'pattern' => '^710([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '710' => ['title' => 'NHRN PZN', 'FNC1' => true, 'pattern' => '^710([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'711' => ['title' => 'NHRN CIP', 'FNC1' => true, 'pattern' => '^711([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '711' => ['title' => 'NHRN CIP', 'FNC1' => true, 'pattern' => '^711([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'712' => ['title' => 'NHRN CN', 'FNC1' => true, 'pattern' => '^712([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '712' => ['title' => 'NHRN CN', 'FNC1' => true, 'pattern' => '^712([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'713' => ['title' => 'NHRN DRN', 'FNC1' => true, 'pattern' => '^713([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '713' => ['title' => 'NHRN DRN', 'FNC1' => true, 'pattern' => '^713([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'714' => ['title' => 'NHRN AIM', 'FNC1' => true, 'pattern' => '^714([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '714' => ['title' => 'NHRN AIM', 'FNC1' => true, 'pattern' => '^714([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'715' => ['title' => 'NHRN NDC', 'FNC1' => true, 'pattern' => '^714([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',], '715' => ['title' => 'NHRN NDC', 'FNC1' => true, 'pattern' => '^714([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,20})$',],
'7230' => ['title' => 'CERT #1', 'FNC1' => true, 'pattern' => '^7230([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{2,30})$',], '7230' => ['title' => 'CERT #1', 'FNC1' => true, 'pattern' => '^7230([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{2,30})$',],
'7231' => ['title' => 'CERT #2', 'FNC1' => true, 'pattern' => '^7231([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{2,30})$',], '7231' => ['title' => 'CERT #2', 'FNC1' => true, 'pattern' => '^7231([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{2,30})$',],
'7232' => ['title' => 'CERT #3', 'FNC1' => true, 'pattern' => '^7232([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{2,30})$',], '7232' => ['title' => 'CERT #3', 'FNC1' => true, 'pattern' => '^7232([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{2,30})$',],
@ -528,16 +528,16 @@ class GS1Datamatrix
'8111' => ['title' => 'POINTS', 'FNC1' => true, 'pattern' => '^8111(\d{4})$',], '8111' => ['title' => 'POINTS', 'FNC1' => true, 'pattern' => '^8111(\d{4})$',],
'8112' => ['title' => '', 'FNC1' => true, 'pattern' => '^8112([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,70})$',], '8112' => ['title' => '', 'FNC1' => true, 'pattern' => '^8112([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,70})$',],
'8200' => ['title' => 'PRODUCT URL', 'FNC1' => true, 'pattern' => '^8200([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,70})$',], '8200' => ['title' => 'PRODUCT URL', 'FNC1' => true, 'pattern' => '^8200([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,70})$',],
'90' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^90([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',], '90' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^90([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,30})$',],
'91' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^91([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], '91' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^91([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',],
'92' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^92([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], '92' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^92([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',],
'93' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^93([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], '93' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^93([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',],
'94' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^94([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], '94' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^94([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',],
'95' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^95([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], '95' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^95([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',],
'96' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^96([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], '96' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^96([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',],
'97' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^97([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], '97' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^97([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',],
'98' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^98([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], '98' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^98([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',],
'99' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^99([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',], '99' => ['title' => 'INTERNAL', 'FNC1' => true, 'pattern' => '^99([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F\x41-\x5A\x5F\x61-\x7A]{0,90})$',],
]; ];
public array $data = []; public array $data = [];

View File

@ -17,13 +17,18 @@ namespace Modules\Labeling\Models;
class Image class Image
{ {
public int $x = 0; public int $x = 0;
public int $y = 0; public int $y = 0;
public float $ratio = 0.0; public float $ratio = 0.0;
public int $x2 = 0; public int $x2 = 0;
public int $y2 = 0; public int $y2 = 0;
public string $src = ''; public string $src = '';
public $resource = null; public $resource = null;
public int $color = 0; public int $color = 0;
} }

View File

@ -73,9 +73,7 @@ class Label
); );
} }
} elseif ($element->type === 3) { } elseif ($element->type === 3) {
} elseif ($element->type === 4) { } elseif ($element->type === 4) {
} }
} elseif ($element instanceof Text) { } elseif ($element instanceof Text) {
\imagettftext($im, $element->size, 0, $element->x, $element->y, $color, $element->font, $element->text); \imagettftext($im, $element->size, 0, $element->x, $element->y, $color, $element->font, $element->text);
@ -117,7 +115,6 @@ class Label
$in = $newIn; $in = $newIn;
} }
$cut = \imagecreatetruecolor($srcW, $srcH); $cut = \imagecreatetruecolor($srcW, $srcH);
\imagecopy($cut, $im, 0, 0, $element->x, $element->y, $srcW, $srcH); \imagecopy($cut, $im, 0, 0, $element->x, $element->y, $srcW, $srcH);
@ -133,7 +130,6 @@ class Label
\imagedestroy($in); \imagedestroy($in);
\imagedestroy($cut); \imagedestroy($cut);
} else { } else {
} }
} }

View File

@ -38,7 +38,7 @@ final class LabelLayoutMapper extends DataMapperFactory
*/ */
public const COLUMNS = [ public const COLUMNS = [
'labeling_layout_id' => ['name' => 'labeling_layout_id', 'type' => 'int', 'internal' => 'id'], 'labeling_layout_id' => ['name' => 'labeling_layout_id', 'type' => 'int', 'internal' => 'id'],
'labeling_layout_template' => ['name' => 'labeling_layout_template', 'type' => 'int', 'internal' => 'template'], 'labeling_layout_template' => ['name' => 'labeling_layout_template', 'type' => 'int', 'internal' => 'template'],
]; ];
/** /**

View File

@ -17,13 +17,17 @@ namespace Modules\Labeling\Models;
class Shape class Shape
{ {
public int $x = 0; public int $x = 0;
public int $y = 0; public int $y = 0;
public int $x2 = 0; public int $x2 = 0;
public int $y2 = 0; public int $y2 = 0;
public int $type = ShapeType::RECTANGLE; public int $type = ShapeType::RECTANGLE;
public int $color = 0; public int $color = 0;
public int $borderThickness = 1; public int $borderThickness = 1;
public int $fillColor = -1; public int $fillColor = -1;

View File

@ -17,22 +17,29 @@ namespace Modules\Labeling\Models;
class Text class Text
{ {
public int $x = 0; public int $x = 0;
public int $y = 0; public int $y = 0;
public int $x2 = 0; public int $x2 = 0;
public int $y2 = 0; public int $y2 = 0;
public int $size = 11; public int $size = 11;
public string $font = __DIR__ . '/../../../Resources/fonts/lato/Lato-Regular.ttf'; public string $font = __DIR__ . '/../../../Resources/fonts/lato/Lato-Regular.ttf';
public string $text = ''; public string $text = '';
public int $color = 0; public int $color = 0;
// align (-1 = start, 0 = middle, 1 = end) // align (-1 = start, 0 = middle, 1 = end)
public int $alignX = -1; public int $alignX = -1;
public int $alignY = -1; public int $alignY = -1;
public bool $bold = false; public bool $bold = false;
public bool $underline = false; public bool $underline = false;
public bool $italic = false; public bool $italic = false;
} }

View File

@ -14,5 +14,5 @@ declare(strict_types=1);
return ['Navigation' => [ return ['Navigation' => [
'Labeling' => 'Labeling', 'Labeling' => 'Labeling',
'List' => 'List', 'List' => 'List',
]]; ]];

View File

@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
$layout = $this->data['layout']; $layout = $this->data['layout'];
$template = \reset($layout->template->sources); $template = \reset($layout->template->sources);

View File

@ -16,18 +16,18 @@ echo $this->data['nav']->render();
$layout = \reset($this->data['layouts']); $layout = \reset($this->data['layouts']);
$media = $layout->template; $media = $layout->template;
$template = \reset($media->sources); $template = \reset($media->sources);
$item = $this->data['item']; $item = $this->data['item'];
$layout = include_once $template->getAbsolutePath(); $layout = include_once $template->getAbsolutePath();
ob_start(); \ob_start();
\imagepng($layout->render()); \imagepng($layout->render());
$imageData = ob_get_clean(); $imageData = \ob_get_clean();
$imageBase64 = base64_encode($imageData); $imageBase64 = \base64_encode($imageData);
// Get the image MIME type // Get the image MIME type
$imageType = 'image/png'; // Assuming JPEG format in this example $imageType = 'image/png'; // Assuming JPEG format in this example