Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Image_Barcode Component Proposal

Proposed Component Name Zend_Image_Barcode
Developer Notes
Proposers Mickael Perraud
julien PAULI
Alexander Veremyev (Zend Liaison)
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 (wiki revision: 28)

Table of Contents

1. Overview

Zend_Image_Barcode is a simple component that create barcode.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will generate barcode image.

4. Dependencies on Other Framework Components

  • PHP Extension : GD
  • Zend_Exception

5. Theory of Operation

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

6. Milestones / Tasks

  • 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

7. Class Index

  • 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...)

8. Use Cases

9. Class Skeletons



Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. May 14, 2008

    <p>What needs to be done on this proposal before moving it on to community review?</p>


  2. Jul 13, 2008

    <p>Looks interesting, is there a way to see the code already?</p>

    <p>Also, do you think it would be possible to broaden the scope and use Zend_Image_Barcode_Writer to be able to add Zend_Image_Barcode_Reader later on? Just food for thoughts.</p>

    <p>On your test page, you compare to the PEAR class - somehow the image (generated by the PEAR class) doesn't load though. This is more of personal, how is your class different from the PEAR class? Where do you see the advantages of using this code vs. the PEAR code (except from PHP5 and that it's part of the ZendFramework "package").</p>


    1. Jul 14, 2008


      <p>I don't have any SVN but I put a view of the current code on <a href="">the same page as the examples</a>.</p>

      <p>I thought of no reader for the moment. What do you think? You provide an image to the reader and it returns the value of the barcode?</p>

      <p>I have no problem on my local server with PEAR (code39), but effectively I will search.</p>

      <p>I realize this code to accept more than the common barcode (code39, code128, interleaved 2 of 5). For example: Kix ("Royal Dutch TPG Post KIX 4-State Barcode") or Postnet ("United States Postal Service Postnet"). Extending the Abstract class must be as easy as possible, just a translation from the coding map (or charset) to an array. I handle exceptions with image error which is a particular barcode. And finally, you can provide an existing image (for example a logo with a blank space) and retrieve the image with the barcode inside. </p>


      1. Jul 14, 2008

        <p>Well, I think reading would be sweet. <ac:emoticon ac:name="smile" /></p>

        <p>I am not sure how to do it on Windows for example, since a *_Reader would have to interface OCR tools I guess, but I am sure it's doable on Linux/Unix. I don't know much about dependencies on external tools/libs and the Zend Framework, maybe your Zend liason could enlighten us.</p>

  3. Oct 29, 2008

    <ac:macro ac:name="note"><ac:parameter ac:name="title">Zend Comments</ac:parameter><ac:rich-text-body>
    <p>This proposal is approved for incubator development, provided that the following issues are addressed:</p>
    <li>That would be good to think about providing vector graphics drawing API to have possibility to draw barcodes into vector formats and make it suitable for Zend_Pdf component</li>

  4. Mar 18, 2009

    <p>Do you guys plan to finish this for inclusion in 1.8?</p>

    1. Apr 06, 2009

      <p>The component couldn't be provide as is. I have some rework to do. I need more informations on Zend_Image proposal and Zend_Pdf (2.0 evolution) to modify structure of the my code to respect Alex's comments.</p>

      <p>I prefer working on my documentation proposal for 1.8.</p>

  5. Aug 23, 2009

    <p>The component has been rewritten according to Alex's comment. The component is divided in BarcodeObjects and Renderers. There are 2 renderer: Image and Pdf.</p>

    <p>The new (and old one) component can be retrieve at svn://</p>

    <p>Unfortunatly, there are neither documentation nor tests for the moment thus the component couldn't be included in library.</p>

  6. Nov 05, 2009

    <p>Is the ability to render 2D barcodes in the future possible with the current implementation? Is there anything that should change in the current implementation to prevent BC breaks in the future when 2D barcodes will be implemented?</p>

    <p>For instance, the concept of a bar height, bar thick width, bar thin width, or even a "bar" for that matter, are specific to linear barcodes only.</p>

    <p>More info:
    <a class="external-link" href=""></a>
    <a class="external-link" href=""></a>
    <a class="external-link" href=""></a>
    <a class="external-link" href=""></a></p>

    1. Nov 11, 2009

      <p>That's exactly why the component is always in incubation. I will commit the current component with all associated tests before the end of the week. Before any promotion to trunk, I want to have at least one 2D barcode adapter (typically QRCode or Datamatrix).</p>

      <p>As I know, I can add 2D barcode without BC breaks.</p>

      <p>There is also 'circular' code (<a class="external-link" href=""></a> or <a class="external-link" href=""></a>).</p>

      1. Oct 06, 2010

        <p>Are there any news on the 2d barcodes? (preferably datamatrix)</p>

        1. Oct 07, 2010

          <p>It's in progress but only for ZF2</p>