Bugzilla – Attachment 129838 Details for
Bug 20894
Add barcode size parameters to /svc/barcode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20894: Add barcode size parameters to /svc/barcode
Bug-20894-Add-barcode-size-parameters-to-svcbarcod.patch (text/plain), 2.73 KB, created by
Lucas Gass (lukeg)
on 2022-01-27 00:10:35 UTC
(
hide
)
Description:
Bug 20894: Add barcode size parameters to /svc/barcode
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2022-01-27 00:10:35 UTC
Size:
2.73 KB
patch
obsolete
>From ffafaf03d890cde5bbbfe0df6b076bd8405be611 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 7 Jan 2022 16:00:52 +0000 >Subject: [PATCH] Bug 20894: Add barcode size parameters to /svc/barcode > >This patch adds a couple of new parameters to the barcode generator >service: "modulesize," which controls the size of QRcodes*, and >"height," which can be applied to all other barcode types. > >* The "modulesize" number refers to the pixel dimensions of each black >and white square in the generated QRcode. The dimensions in "squares" of >the QR code depends on how much data is being encoded. > >For QRcodes, one default parameters is used: An error-correction level >of "M" (Medium, https://en.wikipedia.org/wiki/QR_code#Error_correction). > >To test, apply the patch and restart services. Test various settings to >confirm that barcodes are displayed correctly: > >http://127.0.0.1:8081/cgi-bin/koha/svc/barcode?type=QRcode&modulesize=3&barcode=https%3A%2F%2Fkoha-community.org >http://127.0.0.1:8081/cgi-bin/koha/svc/barcode?type=QRcode&modulesize=6&barcode=https%3A%2F%2Fkoha-community.org >http://127.0.0.1:8081/cgi-bin/koha/svc/barcode?type=Code39&height=50&barcode=32000000203734 >http://127.0.0.1:8081/cgi-bin/koha/svc/barcode?type=Code39&height=20&barcode=32000000203734 >http://127.0.0.1:8081/cgi-bin/koha/svc/barcode?type=COOP2of5&height=50&barcode=32000000203734 >http://127.0.0.1:8081/cgi-bin/koha/svc/barcode?type=IATA2of5&height=50&barcode=32000000203734 >http://127.0.0.1:8081/cgi-bin/koha/svc/barcode?type=Industrial2of5&height=50&barcode=32000000203734 >http://127.0.0.1:8081/cgi-bin/koha/svc/barcode?type=ITF&height=50&barcode=32000000203734 >http://127.0.0.1:8081/cgi-bin/koha/svc/barcode?type=Matrix2of5&height=50&barcode=32000000203734 >http://127.0.0.1:8081/cgi-bin/koha/svc/barcode?type=NW7&height=50&barcode=32000000203734 > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > svc/barcode | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > >diff --git a/svc/barcode b/svc/barcode >index 27d5952cd6..bd9c8203bc 100755 >--- a/svc/barcode >+++ b/svc/barcode >@@ -102,10 +102,16 @@ binmode(STDOUT); > my $type = $input->param('type') || 'Code39'; > my $barcode = $input->param('barcode'); > my $notext = $input->param('notext') ? 1 : 0; >+my $height = $input->param('height') || 50; >+my $qrcode_modulesize = $input->param('modulesize') || "5"; # 1+ > my $image; > > eval { >- $image = GD::Barcode->new( $type, $barcode )->plot( NoText => $notext )->png(); >+ if( $type eq "QRcode" ){ >+ $image = GD::Barcode->new('QRcode', $barcode, { Ecc => "M", ModuleSize => $qrcode_modulesize } )->plot->png(); >+ } else { >+ $image = GD::Barcode->new( $type, $barcode )->plot( NoText => $notext, Height => $height )->png(); >+ } > }; > > if ( $@ ) { >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20894
:
129198
|
129838
|
130040