diff options
-rwxr-xr-x | mat | 12 | ||||
-rwxr-xr-x | sts | 6 |
2 files changed, 16 insertions, 2 deletions
@@ -280,6 +280,11 @@ sub print_label { my $idbarcode = GD::Barcode::QRcode->new(sprintf("%s%d", $Config{'label_id_prefix'}, $id), { Version=>3 }); my $idbarcode_image=$idbarcode->plot(); + my $logo; + if ($ENV{'PRINT_WITH_LOGO'}) { + $logo = GD::Image->newFromPng("layer1.png"); + } + my $idtext = new GD::Image(500, $fontsize * 2); my $white = $idtext->colorAllocate(255,255,255); my $black = $idtext->colorAllocate(0,0,0); @@ -333,10 +338,15 @@ sub print_label { $label->fill(0, 0, $white); $label->copyResized($idbarcode_image, $x_border, $y_border, 0, 0, $idbarcode_image->width() * 5, $idbarcode_image->height() * 5, $idbarcode_image->width(), $idbarcode_image->height()); - $label->copyResized($idtext, $x_border * 2, $y_border + $idbarcode_image->height() * 5, 0, 0, $idtext->width() * 2, $idtext->height() * 2, $idtext->width(), $idtext->height()); + $label->copyResized($idtext, $x_border * 3, $y_border + $idbarcode_image->height() * 5, 0, 0, $idtext->width() * 2, $idtext->height() * 2, $idtext->width(), $idtext->height()); $label->copyResized($text0_image, $label->width() - $x_border - 2 * $fontsize, $y_border, 0, 0, $bounds0[1] * 1, $bounds0[2], $bounds0[1], $bounds0[2]); $label->copyResized($text1_image, $label->width() - $x_border - 4 * $fontsize, $y_border, 0, 0, $bounds1[1] * 1, $bounds1[2], $bounds1[1], $bounds1[2]); $label->copyResized($text2_image, $label->width() - $x_border - 6 * $fontsize, $y_border, 0, 0, $bounds2[1] * 1, $bounds2[2], $bounds2[1], $bounds2[2]); + if ($ENV{'PRINT_WITH_LOGO'}) { + my ($logo_w, $logo_h ) = $logo->getBounds(); + my $vl = $logo->copyRotate90(); + $label->copy($vl, $x_border - 20, $label->height - $y_border + 20 - $logo_w, 0, 0, $logo_h, $logo_w); + } open(PNGFILE, ">label.png"); print PNGFILE $label->png; @@ -2,5 +2,9 @@ # scale triggered store cd $HOME/mat/matplan/ -./mat storeportion `cat currently_cooking` "$1" hemfrys +if (grep -q v currently_cooking); then + PRINT_WITH_LOGO=y ./mat storeportion `cat currently_cooking|sed 's/v//'` "$1" hemfrys +else + ./mat storeportion `cat currently_cooking|sed 's/v//'` "$1" hemfrys +fi |