Menu

## Barcode
in package

Barcode.php : 22

Barcode generation class.

This class generates barcode images using the Barcode 128 encoding.

##### Tags

see
  https://www.kotchasan.com/

### Table of Contents

$font : string
  The font file path.
$bar_width : int
  The width of each bar in the barcode (2D).
$code : string
  The barcode code.
$datas : array<string|int, mixed>
  The barcode data.
$fontSize : int
  The font size of the label text (in pixels).
$height : int
  The height of the barcode.
$width : int
  The total width of the barcode.
create() : static
  Create a Barcode instance.
toPng() : string
  Generate a PNG image of the barcode.
__construct() : mixed
  Class constructor.
Barcode128() : mixed
  แปลงข้อมูล Barcode 128

### Properties

#### $font

Barcode.php : 64

The font file path.

`public string $font = ROOT_PATH . 'skin/fonts/thsarabunnew-webfont.ttf'`

#### $bar_width

Barcode.php : 36

The width of each bar in the barcode (2D).

`private int $bar_width = 1`

#### $code

Barcode.php : 57

The barcode code.

`private string $code`

#### $datas

Barcode.php : 50

The barcode data.

`private array<string|int, mixed> $datas`

#### $fontSize

Barcode.php : 72

The font size of the label text (in pixels).

`private int $fontSize = 0`

0 (default) means no label.

#### $height

Barcode.php : 29

The height of the barcode.

`private int $height`

#### $width

Barcode.php : 43

The total width of the barcode.

`private int $width = 0`

### Methods

#### create()

Barcode.php : 111

Create a Barcode instance.

`public static create(string $code[, int $height = 30 ], int $fontSize) : static`

##### Parameters

$code : string

  The barcode code.

$height : int = 30

  The height of the barcode (in pixels). Default is 30.

$fontSize : int

  The font size of the label text (in pixels), 0 (default) means no label.

##### Return values

static —

#### toPng()

Barcode.php : 121

Generate a PNG image of the barcode.

`public toPng() : string`

##### Return values

string —

The PNG image data.

#### __construct()

Barcode.php : 81

Class constructor.

`protected __construct(string $code, int $height, int $fontSize) : mixed`

##### Parameters

$code : string

  The barcode code.

$height : int

  The height of the barcode (in pixels).

$fontSize : int

  The font size of the label text (in pixels), 0 (default) means no label.

##### Return values

mixed —

#### Barcode128()

Barcode.php : 161

แปลงข้อมูล Barcode 128

`private static Barcode128( $code) : mixed`

##### Parameters

$code :

##### Return values

mixed —

## Search results