Php barcode from image

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Barcode generator, based on Folke Ashberg’s php-barcode.

License

theel0ja/php-barcode

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Читайте также:  Поляков информатика программирование python

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

  • Barcode-Images using libgd (png, jpg,gif),
  • HTML-Images (using 1×1 pixel and html-table)
  • silly Text-Barcodes

PHP-Barcode encodes using

  • a built-in EAN-13/ISBN Encoder
  • genbarcode (by Folke Ashberg), a command line barcode-encoder which uses GNU-Barcode genbarcode can encode EAN-13, EAN-8, UPC, ISBN, 39, 128(a,b,c), I25, 128RAW, CBR, MSI, PLS genbarcode is available at www.ashberg.de/php-barcode

(C) 2001, 2002, 2003, 2004, 2011 by Folke Ashberg folke@ashberg.de

The newest version can be found at http://www.ashberg.de/php-barcode

WHAT YOU NEED TO BE ABLE TO USE PHP-BARCODE

  • You need php>4 on your system.
  • You need the gd2-extension to be able to render images.
  • You need a TrueTypeFont if you want to see the CODE below the bars.
  • You need genbarcode (from www.ashberg.de/php-barcode) in you want to use another encoding than EAN-12/EAN-12/ISBN

Copy the following files into your html/php-directory

  • php-barcode.php — main library
  • encode_bars.php — built-in encoders optional:
  • barcode.php — Sample-File
  • white.png — for HTML-Images
  • black.png — for HTML-Images
 UNIX: A TrueTypeFont isn't included in this distribution! Copy one into the html/php-directory and change in php-barcode.php $font_loc (change the arialbd.tff to your font name). arialbd.ttf from Windows looks great. WINDOWS: If you use Windows the font should be located automatically. 
 If you want to generate not only EAN-12/EAN-13/ISBN-Codes you have to install genbarcode, a small unix-commandline tool which uses GNU-Barcode. genbarcode is available http://www.ashberg.de/php-barcode , read genbarcodes README for installation. If you have installed genbarcode not to /usr/bin set the $genbarcode_loc in php-barcode.php . 
 If everything works fine you should see an image if you call http://localhost/path/barcode.php Or call http://localhost/path/barcode.php?code=&encoding=&mode=&size=

If you need more then the sample barcode.php can do, you need to build your own.

function barcode_encode(code, encoding) encodes $code with $encoding using genbarcode OR built-in encoder if you don’t have genbarcode only EAN-13/ISBN is possible

You can use the following encodings (when you have genbarcode):

ANY choose best-fit (default)
EAN 8 or 13 EAN-Code
Pipe $1
UPC 12-digit EAN
ISBN isbn numbers (still EAN-13)
39 code 39
128 code 128 (a,b,c: autoselection)
128C code 128 (compact form for digits)
128B code 128, full printable ascii
I25 interleaved 2 of 5 (only digits)
128RAW Raw code 128 (by Leonid A. Broukhis)
CBR Codabar (by Leonid A. Broukhis)
MSI MSI (by Leonid A. Broukhis)
PLS Plessey (by Leonid A. Broukhis)
  • array[encoding] : the encoding which has been used
  • array[bars] : the bars
  • array[text] : text-positioning info

function barcode_outimage(text, bars [, scale [, mode [, total_y [, space ]]]] )

Outputs an image using libgd

text the text-line (:: . )
bars where to place the bars (. )
scale scale factor ( 1 < scale < unlimited (scale 50 will produce 5400x300 pixels when using EAN-13. ))
mode png,gif,jpg, depending on libgd ! (default=’png’)
total_y the total height of the image ( default: scale * 60 )
space space
default:
$space[top] = 2 * $scale;
$space[bottom]= 2 * $scale;
$space[left] = 2 * $scale;
$space[right] = 2 * $scale;

function barcode_outhtml(text, bars [, scale [, total_y [, space ]]] )

returns(!) HTML-Code for barcode-image using html-code (using a table and with black.png and white.png)

text
bars
scale
total_y
space
default:
$space[top] = 2 * $scale;
$space[bottom]= 2 * $scale;
$space[left] = 2 * $scale;
$space[right] = 2 * $scale;

function barcode_outtext(code, bars)

Returns (!) a barcode as plain-text

ATTENTION: this is very silly!

text the text-line (:: . )
bars where to place the bars (. )

Also see barcode.php or just use them 🙂

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 

About

Barcode generator, based on Folke Ashberg’s php-barcode.

Источник

ByteScout Barcode Reader SDK – PHP – Read Barcode From Image

How to read barcode from image in PHP and ByteScout BarCode Reader SDK

The tutorial shows how to read barcode from image in PHP

We made thousands of pre-made source code pieces for easy implementation in your own programming projects. What is ByteScout BarCode Reader SDK? It is the barcode decoder with support for code 39, code 128, QR Code, Datamatrix, GS1, PDF417 and all other popular barcodes. Can read barcodes from images, pdf, tiff documents and live web camera. Supports noisy and damaged documents, can split and merge pdf and tiff documents based on barcodes. Can export barcode decoder results to XML, JSON, CSV and into custom data structures. It can help you to read barcode from image in your PHP application.

You will save a lot of time on writing and testing code as you may just take the PHP code from ByteScout BarCode Reader SDK for read barcode from image below and use it in your application. This PHP sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Use of ByteScout BarCode Reader SDK in PHP is also explained in the documentation included along with the product.

ByteScout BarCode Reader SDK free trial version is available on our website. PHP and other programming languages are supported.

HelloWorld.php
"PHP" */ try < // create reader object $reader = new COM("Bytescout.BarCodeReader.Reader"); // Limit search to 1D barcodes only (exclude 2D barcodes to speed up the search). // Change to bc.BarcodeTypesToFind.SetAll() to scan for all supported 1D and 2D barcodes // or select specific type, e.g. bc.BarcodeTypesToFind.PDF417 = True $bc->BarcodeTypesToFind->SetAll1D(); $bc->ReadFromFile("BarcodePhoto.jpg"); For(i = 0; i< $bc->FoundCount-1; i++) < echo "Found barcode on page #" . $bc->GetFoundBarcodePage(i)) . " with type " . $bc->GetFoundBarcodeType(i) . " and value " & bc.GetFoundBarcodeValue(i) & vbCRLF & " and confidence=" . $bc->GetFoundBarcodeConfidence(i) > > catch(Exception $err) // catch exception if any < header("Content-Type: text/plain"); // switch to plain text output type echo($err->getMessage()); // write error message to the output > ?>

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

yet another barcode generator forked from picqer/php-barcode-generator

License

yangyao/php-barcode

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

Readme.md

This repo is forked from https://github.com/picqer/php-barcode-generator, The only difference is the addition of labels,and it will keep up with the original repo in time.

This is an easy to use, non-bloated, framework independent, barcode generator in PHP.

It creates SVG, PNG, JPG and HTML images, from the most used 1D barcode standards.

The codebase is largely from the TCPDF barcode generator by Nicola Asuni. This code is therefor licensed under LGPLv3. It is still a bit of a mess, bit I will clean it in the future. I do not expect the interface of this class will change during the clean ups.

composer require yangyao/php-barcode 

If you want to generate PNG or JPG images, you need the GD library or Imagick installed on your system as well.

Initiate the barcode generator for the output you want, then call the ->getBarcode() routine as many times as you want.

$generator = new Picqer\Barcode\BarcodeGeneratorHTML(); echo $generator->getBarcode('081231723897', $generator::TYPE_CODE_1282,80,[0,0,0],new \Picqer\Barcode\BarcodeLabel('081231723897'));

The ->getBarcode() routine accepts the following:

  • $code Data for the barcode
  • $type Type of barcode, use the constants defined in the class
  • $widthFactor Width is based on the length of the data, with this factor you can make the barcode bars wider than default
  • $totalHeight The total height of the barcode
  • $color Hex code of the foreground color
  • $label for BarcodeLabel instance

The barcode label accpets the following:

  • $text for the label text
  • $textAlign for thr alignment for label text
  • $fontSize for the label text
  • $color for the label text
  • $marginTop for the label text in pixel
  • $marginBottom for the label text in pixel
  • $marginLeft for the label text in pixel
  • $marginRight for the label text in pixel
$generatorSVG = new Picqer\Barcode\BarcodeGeneratorSVG(); $generatorPNG = new Picqer\Barcode\BarcodeGeneratorPNG(); $generatorJPG = new Picqer\Barcode\BarcodeGeneratorJPG(); $generatorHTML = new Picqer\Barcode\BarcodeGeneratorHTML();
  • TYPE_CODE_39
  • TYPE_CODE_39_CHECKSUM
  • TYPE_CODE_39E
  • TYPE_CODE_39E_CHECKSUM
  • TYPE_CODE_93
  • TYPE_STANDARD_2_5
  • TYPE_STANDARD_2_5_CHECKSUM
  • TYPE_INTERLEAVED_2_5
  • TYPE_INTERLEAVED_2_5_CHECKSUM
  • TYPE_CODE_128
  • TYPE_CODE_128_A
  • TYPE_CODE_128_B
  • TYPE_CODE_128_C
  • TYPE_EAN_2
  • TYPE_EAN_5
  • TYPE_EAN_8
  • TYPE_EAN_13
  • TYPE_UPC_A
  • TYPE_UPC_E
  • TYPE_MSI
  • TYPE_MSI_CHECKSUM
  • TYPE_POSTNET
  • TYPE_PLANET
  • TYPE_RMS4CC
  • TYPE_KIX
  • TYPE_IMB
  • TYPE_CODABAR
  • TYPE_CODE_11
  • TYPE_PHARMA_CODE
  • TYPE_PHARMA_CODE_TWO_TRACKS

Embedded PNG image in HTML:

$generator = new \Picqer\Barcode\BarcodeGeneratorPNG(); echo '$generator->getBarcode('081231723897', $generator::TYPE_CODE_128,2,80,'black',new \Picqer\Barcode\BarcodeLabel('081231723897'))) . '">';

About

yet another barcode generator forked from picqer/php-barcode-generator

Источник

Оцените статью