ONO::Lib::Image::Barcode

package ONO::Lib::Image::Barcode;
################################################################################
# COPYRIGHT / LICENSE #
################################################################################
#
# This file is part of the ONO Software Project.
#
# Copyright (C) 2000-2025 Jos KIRPS [ www.kirps.com | jos_AT_kirps_DOT_com ]
# and The Joopita Project [ www.joopita.org | contact_AT_joopita_DOT_com ]
#
# This file, as well as other parts of the ONO Software Project or related
# elements, are FREE SOFTWARE available under the ARTISTIC LICENSE 2.0.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# For the full license, see /ono/osr/license/LICENSE.txt, or write to
# jos_AT_kirps_DOT_com or contact_AT_joopita_DOT_com.
#
################################################################################
# END OF COPYRIGHT / LICENSE, HERE COMES THE CODE ... #
################################################################################

use strict;

use ONO::Core;

###############################################################################
#
###############################################################################

sub make {

#: Generate Barcode or QR code data.

my $type = $_[1];
my $code = $_[2];

my $DATA;

if ($type eq "ean13") {
eval "use GD::Barcode::EAN13";
if (!$@) {
$DATA = GD::Barcode::EAN13->new($code)->plot->png;
}
}

if ($type eq "qr") {
eval "use GD::Barcode::QRcode";
if (!$@) {
$DATA = GD::Barcode::QRcode->new($code)->plot->png;
}
}

return $DATA;

}

###############################################################################
# end of script
###############################################################################

1;

__END__