Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Image Class Reference

Class for rendering the barcode as image. More...

Public Member Functions

 __construct ($options=null)
 Constructor.
 
 setHeight ($value)
 Set height of the result image.
 
 getHeight ()
 Get barcode height.
 
 setWidth ($value)
 Set barcode width.
 
 getWidth ()
 Get barcode width.
 
 setResource ($image)
 Set an image resource to draw the barcode inside.
 
 setImageType ($value)
 Set the image type to produce (png, jpeg, gif)
 
 getImageType ()
 Retrieve the image type to produce.
 
 render ()
 Draw and render the barcode with correct headers.
 
- Public Member Functions inherited from AbstractRenderer
 __construct ($options=null)
 Constructor.
 
 setOptions ($options)
 Set renderer state from options array.
 
 setRendererNamespace ($namespace)
 Set renderer namespace for autoloading.
 
 getRendererNamespace ()
 Retrieve renderer namespace.
 
 setTransparentBackground ($bool)
 Set whether background should be transparent Will work for SVG and Image (png and gif only)
 
 getTransparentBackground ()
 
 getType ()
 Retrieve renderer type.
 
 setTopOffset ($value)
 Manually adjust top position.
 
 getTopOffset ()
 Retrieve vertical adjustment.
 
 setLeftOffset ($value)
 Manually adjust left position.
 
 getLeftOffset ()
 Retrieve vertical adjustment.
 
 setAutomaticRenderError ($value)
 Activate/Deactivate the automatic rendering of exception.
 
 setHorizontalPosition ($value)
 Horizontal position of the barcode in the rendering resource.
 
 getHorizontalPosition ()
 Horizontal position of the barcode in the rendering resource.
 
 setVerticalPosition ($value)
 Vertical position of the barcode in the rendering resource.
 
 getVerticalPosition ()
 Vertical position of the barcode in the rendering resource.
 
 setModuleSize ($value)
 Set the size of a module.
 
 getModuleSize ()
 Set the size of a module.
 
 getAutomaticRenderError ()
 Retrieve the automatic rendering of exception.
 
 setBarcode (Object\ObjectInterface $barcode)
 Set the barcode object.
 
 getBarcode ()
 Retrieve the barcode object.
 
 checkParams ()
 Checking of parameters after all settings.
 
 draw ()
 Draw the barcode in the rendering resource.
 
- Public Member Functions inherited from RendererInterface
 setBarcode (ObjectInterface $barcode)
 Set the barcode object.
 

Protected Member Functions

 initRenderer ()
 Initialize the image resource.
 
 checkSpecificParams ()
 Check barcode parameters.
 
 checkDimensions ()
 Check barcode dimensions.
 
 drawPolygon ($points, $color, $filled=true)
 Draw a polygon in the image resource.
 
 drawText ($text, $size, $position, $font, $color, $alignment= 'center', $orientation=0)
 Draw a polygon in the image resource.
 
- Protected Member Functions inherited from AbstractRenderer
 checkBarcodeObject ()
 Check if a barcode object is correctly provided.
 
 adjustPosition ($supportHeight, $supportWidth)
 Calculate the left and top offset of the barcode in the rendering support.
 
 checkSpecificParams ()
 Checking of parameters after all settings.
 
 initRenderer ()
 Initialize the rendering resource.
 
 drawPolygon ($points, $color, $filled=true)
 Draw a polygon in the rendering resource.
 
 drawText ($text, $size, $position, $font, $color, $alignment= 'center', $orientation=0)
 Draw a polygon in the rendering resource.
 

Protected Attributes

 $allowedImageType
 
 $imageType = 'png'
 
 $resource = null
 
 $imageForeColor = null
 
 $imageBackgroundColor = null
 
 $userHeight = 0
 
 $userWidth = 0
 
- Protected Attributes inherited from AbstractRenderer
 $rendererNamespace = 'Zend\Barcode\Renderer'
 
 $type = null
 
 $automaticRenderError = false
 
 $topOffset = 0
 
 $leftOffset = 0
 
 $horizontalPosition = 'left'
 
 $verticalPosition = 'top'
 
 $moduleSize = 1
 
 $barcode
 
 $resource
 Drawing resource.
 
 $transparentBackground = false
 

Detailed Description

Class for rendering the barcode as image.

Constructor & Destructor Documentation

__construct (   $options = null)

Constructor.

Parameters
array | \Traversable$options
Exceptions
RendererCreationException

Implements RendererInterface.

Member Function Documentation

checkDimensions ( )
protected

Check barcode dimensions.

Exceptions
Exception\RuntimeException
Returns
void
checkSpecificParams ( )
protected

Check barcode parameters.

Returns
void
drawPolygon (   $points,
  $color,
  $filled = true 
)
protected

Draw a polygon in the image resource.

Parameters
array$points
int$color
bool$filled
drawText (   $text,
  $size,
  $position,
  $font,
  $color,
  $alignment = 'center',
  $orientation = 0 
)
protected

Draw a polygon in the image resource.

Parameters
string$text
float$size
array$position
string$font
int$color
string$alignment
float | int$orientation
Exceptions
Exception\RuntimeException

imagestring() doesn't allow orientation, if orientation needed: a TTF font is required. Throwing an exception here, allow to use automaticRenderError to inform user of the problem instead of simply not drawing the text

getHeight ( )

Get barcode height.

Returns
int
getImageType ( )

Retrieve the image type to produce.

Returns
string
getWidth ( )

Get barcode width.

Returns
int
initRenderer ( )
protected

Initialize the image resource.

Returns
void
render ( )

Draw and render the barcode with correct headers.

Returns
mixed

Implements RendererInterface.

setHeight (   $value)

Set height of the result image.

Parameters
null | int$value
Exceptions
Exception\OutOfRangeException
Returns
Image
setImageType (   $value)

Set the image type to produce (png, jpeg, gif)

Parameters
string$value
Exceptions
Exception\InvalidArgumentException
Returns
Image
setResource (   $image)

Set an image resource to draw the barcode inside.

Parameters
resource$image
Returns
Image
Exceptions
Exception\InvalidArgumentException
setWidth (   $value)

Set barcode width.

Parameters
mixed$value
Exceptions
Exception\OutOfRangeException
Returns
self

Member Data Documentation

$allowedImageType
protected
Initial value:
= [
'png',
'jpeg',
'gif',
]
$imageBackgroundColor = null
protected
$imageForeColor = null
protected
$imageType = 'png'
protected
$resource = null
protected
$userHeight = 0
protected
$userWidth = 0
protected