All Projects → dsiddharth2 → Php Zxing

dsiddharth2 / Php Zxing

Licence: mit
PHP wrapper for Zxing Java library

Labels

Projects that are alternatives of or similar to Php Zxing

Py Ubjson
Universal Binary JSON draft-12 serializer for Python
Stars: ✭ 30 (-67.74%)
Mutual labels:  decoder
Logisim
Logisim Italian Fork
Stars: ✭ 61 (-34.41%)
Mutual labels:  decoder
Vvdec
Fraunhofer Versatile Video Decoder (VVdeC)
Stars: ✭ 84 (-9.68%)
Mutual labels:  decoder
Php Qrcode Detector Decoder
This is a PHP library to detect and decode QR-codes. This is first and only QR code reader that works without extensions.
Stars: ✭ 1,034 (+1011.83%)
Mutual labels:  decoder
Ksd
kubernetes secret decoder
Stars: ✭ 59 (-36.56%)
Mutual labels:  decoder
Polar 3gpp Matlab
Matlab simulations of the encoder and SCL decoder for the New Radio polar code from 3GPP Release 15
Stars: ✭ 67 (-27.96%)
Mutual labels:  decoder
Idutf8lib
Idiot's UTF-8 Library
Stars: ✭ 12 (-87.1%)
Mutual labels:  decoder
Niutrans.smt
NiuTrans.SMT is an open-source statistical machine translation system developed by a joint team from NLP Lab. at Northeastern University and the NiuTrans Team. The NiuTrans system is fully developed in C++ language. So it runs fast and uses less memory. Currently it supports phrase-based, hierarchical phrase-based and syntax-based (string-to-tree, tree-to-string and tree-to-tree) models for research-oriented studies.
Stars: ✭ 90 (-3.23%)
Mutual labels:  decoder
Iced
Blazing fast and correct x86/x64 disassembler, assembler, decoder, encoder for .NET, Rust, Python, JavaScript
Stars: ✭ 1,102 (+1084.95%)
Mutual labels:  decoder
Faad2
Freeware Advanced Audio (AAC) Decoder faad2 mirror
Stars: ✭ 82 (-11.83%)
Mutual labels:  decoder
Mime
Fast, robust, standards-compliant MIME decoder. Ships with extensive tests and fuzz tests.
Stars: ✭ 57 (-38.71%)
Mutual labels:  decoder
Ffjpeg
a simple jpeg codec.
Stars: ✭ 58 (-37.63%)
Mutual labels:  decoder
Alfalfa
Purely functional video codec, used for ExCamera and Salsify
Stars: ✭ 1,164 (+1151.61%)
Mutual labels:  decoder
Seg Mentor
TFslim based semantic segmentation models, modular&extensible boutique design
Stars: ✭ 43 (-53.76%)
Mutual labels:  decoder
Decoder
一个网络摄像头解码监控平台
Stars: ✭ 86 (-7.53%)
Mutual labels:  decoder
Wxinlineplayer
🤟Super fast H.264/H.265 FLV player
Stars: ✭ 873 (+838.71%)
Mutual labels:  decoder
Json Decoder
Type safe JSON decoder for TypeScript
Stars: ✭ 67 (-27.96%)
Mutual labels:  decoder
Wx Voice
Convert audio files between Tencent apps (Weixin / Wechat, QQ) and Silk codec with other general formats such as MP3 and M4A
Stars: ✭ 93 (+0%)
Mutual labels:  decoder
Opusfile
Stand-alone decoder library for .opus streams
Stars: ✭ 86 (-7.53%)
Mutual labels:  decoder
Decoder Plus Plus
An extensible application for penetration testers and software developers to decode/encode data into various formats.
Stars: ✭ 79 (-15.05%)
Mutual labels:  decoder

PHPZxing - Wrapper for Zxing Java Library

PHPZxing is a small php wrapper that uses the Zxing library to Create and read Barcodes. Under the hood it still uses the Zxing library to encode and decode data.

Install using composer

{  
    "require": {
        "dsiddharth2/php-zxing": "1.0.3"
    }  
}

Note

  • Only Decoder is programmed right now. Needs programming of Encoder.
  • The Default location of java that is configured is /usr/bin/java

Changes in version 1.0.3

  • Functionality added for possible_formats to work

Changes in version 1.0.2

  • Updated the new jars and tested on windows system

Changes in version 1.0.1

  • Added a isFound function that will tell if the bar code is found.
  • If the image has one bar code detected, then it returns the object instead of array of a single object.

Basic Usage

use PHPZxing\PHPZxingDecoder;

$decoder        = new PHPZxingDecoder();
$data           = $decoder->decode('../images/Code128Barcode.jpg');
if($data->isFound()) {
    $data->getImageValue();
    $data->getFormat();
    $data->getType();        
}

The Decoded data is an Array of Objects of PHPZxing\ZxingImage if the bar code is found. If not found then it is an array of Objects PHPZxing\ZxingBarNotFound.

Checking for existence of Barcode

The Existance of bar code can be found using the functoin isFound()

use PHPZxing\PHPZxingDecoder;

$decoder        = new PHPZxingDecoder();
$data           = $decoder->decode('../images/Code128Barcode.jpg');
if($data->isFound()) {
    $data->getImageValue();
    $data->getFormat();
    $data->getType();        
}

You can also check using the instanceof object,

use PHPZxing\PHPZxingDecoder;

$decoder        = new PHPZxingDecoder();
$data           = $decoder->decode('../images/Code128Barcode.jpg');
if($data instanceof PHPZxing\ZxingImage) {
    $data->getImageValue();
    $data->getFormat();
    $data->getType();
}

The Public methods that we can use in PHPZxing\ZxingImage are,

Method Name Function
getImageValue Get the value decoded in the image passed
getFormat Get the format of the image that is encoded, example : CODE_39
getType Get the type of the image decoded, example : URL, TEXT etc
getImagePath Get Path of the image

The Public methods that we can use in PHPZxing\ZxingImage are,

Method Name Function
getImageErrorCode Get the error code for the image not found
getErrorMessage Error Message
getImagePath Get Path of the image

Setting the configurations

use PHPZxing\PHPZxingDecoder;

$config = array(
    'try_harder'            => true,
);
$decoder        = new PHPZxingDecoder($config);
$decodedArray   = $decoder->decode('../images');
if(is_array($decodedArray)){
    foreach ($decodedArray as $data) {
        if($data->isFound()) {
            print_r($data);
        }
    }
}

You can also use it with configurations. The Decoder has 4 configurations,

Config Name Function
try_harder If the image has bar/Qr code at unknown locations, then use this non mobile mode.
multiple_bar_codes If the image has multiple bar codes you want to read.
crop Crop the image and it will read only the cropped portion
possible_formats List of formats to decode, where format is any value in BarcodeFormat

More Examples

You can pass array of images too,

use PHPZxing\PHPZxingDecoder;

$decoder        = new PHPZxingDecoder();
$imageArrays = array(
    '../images/Code128Barcode.jpg',
    '../images/Code39Barcode.jpg'
);
$decodedArray  = $decoder->decode($imageArrays);
foreach ($decodedArray as $data) {
    if($data instanceof PHPZxing\ZxingImage) {
        print_r($data);
    } else {
        echo "Bar Code cannot be read";
    }
}

Reading multiple bar codes,

use PHPZxing\PHPZxingDecoder;

$config = array(
    'try_harder' => true,
    'multiple_bar_codes' => true
);
$decoder        = new PHPZxingDecoder($config);
$decodedData    = $decoder->decode('../images/multiple_bar_codes.jpg');
print_r($decodedData);

Set Java Path

If your java PATH is not set properly, the decoder will not work. You need to set path of java variable.

use PHPZxing\PHPZxingDecoder;

$decoder        = new PHPZxingDecoder();
$decoder->setJavaPath('/your/path/to/java');
$decodedData    = $decoder->decode('../images/Code128Barcode.jpg');
print_r($decodedData);

Where is my java located ?

If you do not know the path to java, then you can use the following on *nix enviromnents

$ which java

On Windows environment,

> where java

For more info, on Windows read the follwoing stackoverflow Link

Acknowledgments

Contibution

Please Contribute or suggest changes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].