-
-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Use Imager::zxing to read barcodes from uploaded images #9051
Conversation
- Remove redundant `$` - Fix scope of `$ai_data_str` - Some regexes
- Ensure that more GS1 Data Link URI formats can be 'normalized' - URIs that cannot be a GS1 Data Link should not be treated as an product code
- libzxing-dev requires a the current Debian stable, bookworm. - libapache2-request-perl is only available via backports for bookworm.
test: Add first unittest for GS1 DataMatrix code Thanks to @tonycoz (TONYC on cpan) for implementing Imager::zxing!
Kudos, SonarCloud Quality Gate passed! |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #9051 +/- ##
==========================================
+ Coverage 48.84% 48.99% +0.14%
==========================================
Files 66 66
Lines 20380 20398 +18
Branches 4891 4896 +5
==========================================
+ Hits 9955 9993 +38
+ Misses 9166 9138 -28
- Partials 1259 1267 +8 ☔ View full report in Codecov by Sentry. |
@hangy @alexgarel WDYT ? |
@hangy this could be merged now I think as we moved to the new server :-) |
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank @hangy !
LGTM, just some minor comments or explanations needed.
} | ||
} | ||
|
||
if (not(defined $code)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (not(defined $code)) { | |
# zbar failed, try with zxing | |
if (not(defined $code)) { |
$code = $result->text(); | ||
my $type = $result->format(); | ||
$log->debug("barcode found", {code => $code, type => $type}) if $log->is_debug(); | ||
print STDERR "scan_code code found: $code\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better remove this :-)
print STDERR "scan_code code found: $code\n"; |
my $type = $result->format(); | ||
$log->debug("barcode found", {code => $code, type => $type}) if $log->is_debug(); | ||
print STDERR "scan_code code found: $code\n"; | ||
if (($code !~ /^\d+|(?:[\^(\N{U+001D}\N{U+241D}]|https?:\/\/).+$/)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting is a must have here :-)
I'm not able to understand what the [\^(\N{U+001D}\N{U+241D}]
is for !
if (($code !~ /^\d+|(?:[\^(\N{U+001D}\N{U+241D}]|https?:\/\/).+$/)) { | |
# we want a sequence of numbers, | |
# or a url | |
if (($code !~ /^\d+|(?:[\^(\N{U+001D}\N{U+241D}]|https?:\/\/).+$/)) { |
["08_gs1_databar_stacked_omni.jpg", "5010029000214"], | ||
["37_gs1_datamatrix.jpg", "0725272730706"], | ||
["43_gs1_qrcode_digital_link.jpg", "9506000134369"], | ||
["52_gs1_datamatrix_digital_link.jpg", "5010029000214"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
["52_gs1_datamatrix_digital_link.jpg", "5010029000214"] | |
# extracted from https://id.gs1.org/01/05010029000214/10/AbC/21/666?17=301010 | |
["52_gs1_datamatrix_digital_link.jpg", "5010029000214"] |
["07_gs1_databar_stacked.jpg", "5010029000214"], | ||
["08_gs1_databar_stacked_omni.jpg", "5010029000214"], | ||
["37_gs1_datamatrix.jpg", "0725272730706"], | ||
["43_gs1_qrcode_digital_link.jpg", "9506000134369"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
["43_gs1_qrcode_digital_link.jpg", "9506000134369"], | |
# extracted from https://dalgiardino.com/01/09506000134369/10/ABC/21/123456?17=230829 | |
["43_gs1_qrcode_digital_link.jpg", "9506000134369"], |
What
Use Perl module
Imager::zxing
to read barcodes from images to enable support for more barcode types that are not supported byBarcode::ZBar
, ie. DataMatrix. By passing the values toGS1::SyntaxEngine::FFI
, this allows GS1 Data URI, GS1 DataMatrix, and GS1 QR Code barcodes to be used & parsed when uploading images to Product Opener.Related issue(s) and discussion