Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

bymayo/craft-barcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ Deprecated - This Craft CMS 2.x plugin is no longer supported.

Barcode for Craft 2.x

Barcode is a Craft CMS plugin that allows you to generate a barcode image (Or HTML) in your templates using Twig.

This was built for a project that required barcodes to be generated in Twig and exported via a PDF.

It uses the PHP Barcode Generator (https://github.com/picqer/php-barcode-generator) library and includes all the options from there.

Install

  • Add the barcode directory into your craft/plugins directory.
  • Navigate to Settings -> Plugins and click the "Install" button.

Templating

There is only one method that you can use - generate.

{{ craft.barcode.generate(
	{
		code: '8745364267452',
		barcodeImageType: 'svg',
		type: 'TYPE_CODE_128'
	}
) }}

Templating Options

Name Type Default Value Required Description
code string null Yes The code data the barcode should be generated from.
barcodeImageType string null Yes Image type you want to output the barcode as. Accepts svg, png, jpg or html (Must be lowercase)
type string null Yes The type of barcode you want to output, accepts all the 'Accepted types' from https://github.com/picqer/php-barcode-generator#accepted-types.
color string 000000 --- Foreground colour of the barcode, accepts all HEX codes (Without the #)
width integer 2 --- Width is based on the length of the data, with this you can make the barcode bars wider.
height integer 30 --- Height of the barcode in pixels.

Credits

Barcode Scanner by ProSymbols from Noun Project (https://thenounproject.com/prosymbols/)

Releases

No releases published

Packages

No packages published

Languages