View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

[Alexander Veremyev (Zend Liaison)|~alexander]

0.1 - 15 March 2008: Initial proposal creation.
0.2 - 25 May 2008 : Correction and additions
0.3 - 13 July 2008: Add prototype and more description

Zend_Image_Barcode is a simple component that create barcode.



* This component *will* generate barcode image.

* PHP Extension : GD
* Zend_Exception

Full example site: [Barcode Test|]

Zend_Image_Barcode can easily create barcode without any parameter setting except the type and the value to encode.

However, Zend_Image_Barcode is entirely customizable:
- independent adjustment of width of bars (thin, thick), font
- global adjustment for this by factor
- setting of font (TTF or gd built-in fonts)
- activation of checksum
- setting color (background and bars)
- setting of result image (height, width, type)
- creating blank image or using an existant resource
- exception handling with image rendering
- automatic render or return resource

* Milestone 1: [DONE] Create the proposal
* Milestone 2: [DONE] Initial class design
* Milestone 3: Submit the proposal for community review
* Milestone 4: Create working prototype
* Milestone 5: Create code-covering unit tests.
* Milestone 6: Writing documentation

* Zend_Image_Barcode_Exception
* Zend_Image_Barcode (factory class)
* Zend_Image_Barcode_Abstract
* Zend_Image_Barcode_Int25
* Zend_Image_Barcode_Code39
* Additional will come later (EAN, Code128...)

{deck:id=Use Cases}

{card:label=UC-01 - Array}
// or
$image = Zend_Image_Barcode::draw('int25',array('text'=>'0123456789'));

{card:label=UC-02 - Config}
{code:none|title=myapp.ini file}
barcode = int25
params.text = 0123456789{code}
$config = new Zend_Config_Ini('app.ini', 'barcode');
// or
$image = Zend_Image_Barcode::draw($config);




static resource draw (mixed $barcode, [mixed $config = array()])
static Mp_Image_Barcode_Abstract factory (mixed $barcode, [mixed $config = array ()])
static void render (mixed $barcode, [mixed $config = array()])
void setBarcodeFont (string $font)



static void setBarcodeFont (string $font)
void __construct ([array|Zend_Config $options = null])
void __destruct ()
resource draw ()
string getAdditionalText ()
boolean getAutomaticRenderImageError ()
integer getBackgroundColor ()
integer getBarHeight ()
integer getBarThickWidth ()
integer getBarThinWidth ()
boolean getDrawText ()
integer getFactor ()
integer|string getFont ()
unknown getForeColor ()
integer getHeight ()
boolean getImageErrorHandler ()
string getImageType ()
integer getLeft ()
integer getOrientation ()
integer|array getPadding ([integer $where = null])
integer getQuietZone ()
boolean getStretchText ()
string getText ()
integer getTop ()
float getTtfFontSize ()
integer getWidth ()
boolean getWithBorder ()
boolean getWithChecksum ()
void|resource handleException ( $e)
void render ()
MP_Image_Barcode_Abstract setAdditionalText (string $value)
Mp_Image_Barcode_Abstract setAutomaticRenderImageError (boolean $value)
Mp_Image_Barcode_Abstract setBackgroundColor (integer $value)
Mp_Image_Barcode_Abstract setBarHeight (integer $value)
Mp_Image_Barcode_Abstract setBarThickWidth (integer $value)
Mp_Image_Barcode_Abstract setBarThinWidth (integer $value)
Mp_Image_Barcode_Abstract setConfig ( $config)
MP_Image_Barcode_Abstract setDrawText (boolean $value)
Mp_Image_Barcode_Abstract setFactor (integer $value)
MP_Image_Barcode_Abstract setFont (integer|string $value)
Mp_Image_Barcode_Abstract setForeColor (string $value)
Mp_Image_Barcode_Abstract setHeight (integer $value)
Mp_Image_Barcode_Abstract setImageErrorHandler (boolean $value)
Mp_Image_Barcode_Abstract setImageResource (resource $value)
Mp_Image_Barcode_Abstract setImageType (string $value)
Mp_Image_Barcode_Abstract setLeft (integer $value)
Mp_Image_Barcode_Abstract setOptions (array $options)
Mp_Image_Barcode_Abstract setOrientation (integer $value)
Mp_Image_Barcode_Abstract setPadding (integer|array $value)
Mp_Image_Barcode_Abstract setReverseColor ()
MP_Image_Barcode_Abstract setStretchText (boolean $value)
MP_Image_Barcode_Abstract setText (string $value)
Mp_Image_Barcode_Abstract setTop (integer $value)
Mp_Image_Barcode_Abstract setTtfFontSize (float $value)
Mp_Image_Barcode_Abstract setWidth (integer $value)
Mp_Image_Barcode_Abstract setWithBorder (boolean $value)
Mp_Image_Barcode_Abstract setWithChecksum (boolean $value)
string validateText ( $value)
integer _calculateBarcodeHeight ()
integer _calculateBarcodeWidth ()
integer _calculateHeight ()
integer _calculateWidth ()
integer _characterLength ()
void _checkDimensions ()
void _checkFontAndOrientation ()
void _checkParams ()
void _checkRatio ([integer $min = 2], [integer $max = 3])
void _childCheckParams ()
resource _createImage ()
resource _drawBarcode ()
void _drawBorder ( &$image, resource $image)
void _drawText ( &$image)
void _postDrawBarcode (resource $image)
void _preDrawBarcode (resource $image)
array _prepareBarcode ()
array _rotate (float $x1, float $y1)



boolean getWithBearerBars ()
Mp_Image_Barcode_Abstract setWithBearerBars (boolean $value)
string validateText (string $value)
int _calculateBarcodeWidth ()
integer _characterLength ()
void _childCheckParams ()
resource _postDrawBarcode (resource $image)
array _prepareBarcode ()



string validateText (string $value)
int _calculateBarcodeWidth ()
integer _characterLength ()
void _childCheckParams ()
array _prepareBarcode ()


class Zend_Image_Barcode_Exception extends Zend_Exception {}