Skip to content

ColorbarCoder is PHP class for encoding and decoding color barcode image.

License

Notifications You must be signed in to change notification settings

Susros/ColorbarCoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ColorbarCoder

ColorbarCoder

ColorbarCoder encodes the original text string to color codes and decode color codes from color bar image into its original text.

Documentation

Full documentation: Here

Installation

ColorbarCoder can be downloaded manually or cloneed by using:

git clone git@github.com:Susros/ColorbarCoder.git

ColorbarCoder is also availabe on Packagist. To install it with Composer, add this line to your composer.json file:

"susros/colorbarcoder" : "~1.0.2"

or run

composer require susros/colorbarcoder

Basic Usage

Include ColorbarCoder if you are not using autoload.

include_once "path/to/ColorbarCoder.php";
use ColorbarCoder\ColorbarCoder;

Instantiate ColorbarCoder

$colorbarCoder = new ColorbarCoder();

Encode the text,

// Original text 
$text = "This is awesome!"; 

// Encode the text
$colorbarCoder->encode($text);

Print the colorbar image,

$colorbarCoder->printColorbarImage(500, 500);

This will print out image with 500 x 500 dimention. The default image extension is PNG. JPG format can be created by declaring JPG in the parameter. However, only PNG works for decoding the color bar as JPG will reduce the quality and result in different color code. Therefore, the original text will not be accurate. It is recommended to use PNG instead.

alt text

Decode the color bar image,

// Image file
$image = "./img/colorbar.png";

// Decode the image
$colorbarCoder->decode($image);

Print the decoded text,

echo $colorbarCoder->getText();

Output

This is awesome!

For more usages: See here

About

ColorbarCoder is PHP class for encoding and decoding color barcode image.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages