View Source

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

{zone-data:proposer-list}
[~mikaelkael]
[~doctorrock83]
[Alexander Veremyev (Zend Liaison)|~alexander]
{zone-data}

{zone-data:revision}
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
{zone-data}

{zone-data:overview}
Zend_Image_Barcode is a simple component that create barcode.
{zone-data}

{zone-data:references}
* http://pear.php.net/package/Image_Barcode
* http://www.barcode-1.net/pub/russadam/
* http://www.barcodeman.com/info/barspec.php
* http://pit.free.fr/codes.php
{zone-data}

{zone-data:requirements}

* This component *will* generate barcode image.
{zone-data}

{zone-data:dependencies}
* PHP Extension : GD
* Zend_Exception
{zone-data}

{zone-data:operation}
Full example site: [Barcode Test|http://www.mikaelkael.fr/barcode/]

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
{zone-data}

{zone-data:milestones}
* 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
{zone-data}

{zone-data:class-list}
* 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...)
{zone-data}

{zone-data:use-cases}
{deck:id=Use Cases}

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

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

{card}

{deck}
{zone-data}

{zone-data:skeletons}
{deck:id=Skeletons}
{card:label=Zend_Image_Barcode}

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)

{card}

{card:label=Zend_Image_Barcode_Abstract}

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)

{card}

{card:label=Zend_Image_Barcode_Int25}

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 ()

{card}

{card:label=Zend_Image_Barcode_Code39}

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

{card}

{card:label=Zend_Image_Barcode_Exception}
{code:php}
class Zend_Image_Barcode_Exception extends Zend_Exception {}
{code}
{card}

{deck}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>