Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

#3 Have other drivers use writer

  • Loading branch information...
commit 4e25dccc1e2cbe77091f345b534121c77486b294 1 parent 9119fe0
Daniel O'Connor authored
16 Image/Barcode2/int25.php
View
@@ -135,14 +135,14 @@ public function draw($text)
+ (7 * $this->_barthinwidth + $this->_barthickwidth) + 3;
// Create the image
- $img = imagecreate($barcodewidth, $this->_barcodeheight);
+ $img = $this->writer->imagecreate($barcodewidth, $this->_barcodeheight);
// Alocate the black and white colors
- $black = imagecolorallocate($img, 0, 0, 0);
- $white = imagecolorallocate($img, 255, 255, 255);
+ $black = $this->writer->imagecolorallocate($img, 0, 0, 0);
+ $white = $this->writer->imagecolorallocate($img, 255, 255, 255);
// Fill image with white color
- imagefill($img, 0, 0, $white);
+ $this->writer->imagefill($img, 0, 0, $white);
// Initiate x position
$xpos = 0;
@@ -150,7 +150,7 @@ public function draw($text)
// Draws the leader
for ($i = 0; $i < 2; $i++) {
$elementwidth = $this->_barthinwidth;
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -180,7 +180,7 @@ public function draw($text)
$elementwidth = $this->_barthickwidt;
}
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -205,7 +205,7 @@ public function draw($text)
// Draws the trailer
$elementwidth = $this->_barthickwidth;
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -217,7 +217,7 @@ public function draw($text)
$xpos += $this->_barthinwidth;
$xpos ++;
$elementwidth = $this->_barthinwidth;
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
14 Image/Barcode2/postnet.php
View
@@ -141,20 +141,20 @@ public function draw($text)
+ $this->_barwidth * 3;
// Create the image
- $img = imagecreate($barcodewidth, $this->_bartallheight);
+ $img = $this->writer->imagecreate($barcodewidth, $this->_bartallheight);
// Alocate the black and white colors
- $black = imagecolorallocate($img, 0, 0, 0);
- $white = imagecolorallocate($img, 255, 255, 255);
+ $black = $this->writer->imagecolorallocate($img, 0, 0, 0);
+ $white = $this->writer->imagecolorallocate($img, 255, 255, 255);
// Fill image with white color
- imagefill($img, 0, 0, $white);
+ $this->writer->imagefill($img, 0, 0, $white);
// Initiate x position
$xpos = 0;
// Draws the leader
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -176,7 +176,7 @@ public function draw($text)
$elementheight = 0;
}
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
$elementheight,
@@ -190,7 +190,7 @@ public function draw($text)
}
// Draws the trailer
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
53 Image/Barcode2/upca.php
View
@@ -141,26 +141,26 @@ public function draw($text)
+ 3 // left
+ 5 // center
+ 3 // right
- + imagefontwidth($this->_font) + 1
- + imagefontwidth($this->_font) + 1 // check digit's padding
+ + $this->writer->imagefontwidth($this->_font) + 1
+ + $this->writer->imagefontwidth($this->_font) + 1 // check digit padding
;
- $barcodelongheight = (int) (imagefontheight($this->_font) / 2)
+ $barcodelongheight = (int)($this->writer->imagefontheight($this->_font) / 2)
+ $this->_barcodeheight;
// Create the image
- $img = imagecreate(
+ $img = $this->writer->imagecreate(
$barcodewidth,
- $barcodelongheight + imagefontheight($this->_font) + 1
+ $barcodelongheight + $this->writer->imagefontheight($this->_font) + 1
);
// Alocate the black and white colors
- $black = imagecolorallocate($img, 0, 0, 0);
- $white = imagecolorallocate($img, 255, 255, 255);
+ $black = $this->writer->imagecolorallocate($img, 0, 0, 0);
+ $white = $this->writer->imagecolorallocate($img, 255, 255, 255);
// Fill image with white color
- imagefill($img, 0, 0, $white);
+ $this->writer->imagefill($img, 0, 0, $white);
// get the first digit which is the key for creating the first 6 bars
$key = substr($text, 0, 1);
@@ -169,13 +169,20 @@ public function draw($text)
$xpos = 0;
// print first digit
- imagestring($img, $this->_font, $xpos, $this->_barcodeheight, $key, $black);
- $xpos = imagefontwidth($this->_font) + 1;
+ $this->writer->imagestring(
+ $img,
+ $this->_font,
+ $xpos,
+ $this->_barcodeheight,
+ $key,
+ $black
+ );
+ $xpos = $this->writer->imagefontwidth($this->_font) + 1;
// Draws the left guard pattern (bar-space-bar)
// bar
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -188,7 +195,7 @@ public function draw($text)
// space
$xpos += $this->_barwidth;
// bar
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -202,7 +209,7 @@ public function draw($text)
foreach ($this->_number_set[$key]['L'] as $bar) {
if ($bar) {
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -218,7 +225,7 @@ public function draw($text)
// Draw left $text contents
for ($idx = 1; $idx < 6; $idx ++) {
$value = substr($text, $idx, 1);
- imagestring(
+ $this->writer->imagestring(
$img,
$this->_font,
$xpos+1,
@@ -229,7 +236,7 @@ public function draw($text)
foreach ($this->_number_set[$value]['L'] as $bar) {
if ($bar) {
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -247,7 +254,7 @@ public function draw($text)
// space
$xpos += $this->_barwidth;
// bar
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -259,7 +266,7 @@ public function draw($text)
// space
$xpos += $this->_barwidth;
// bar
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -275,7 +282,7 @@ public function draw($text)
// Draw right $text contents
for ($idx = 6; $idx < 11; $idx ++) {
$value = substr($text, $idx, 1);
- imagestring(
+ $this->writer->imagestring(
$img,
$this->_font,
$xpos + 1,
@@ -285,7 +292,7 @@ public function draw($text)
);
foreach ($this->_number_set[$value]['R'] as $bar) {
if ($bar) {
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -303,7 +310,7 @@ public function draw($text)
$value = substr($text, 11, 1);
foreach ($this->_number_set[$value]['R'] as $bar) {
if ($bar) {
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -320,7 +327,7 @@ public function draw($text)
// Draws the right guard pattern (bar-space-bar)
// bar
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -333,7 +340,7 @@ public function draw($text)
// space
$xpos += $this->_barwidth;
// bar
- imagefilledrectangle(
+ $this->writer->imagefilledrectangle(
$img,
$xpos,
0,
@@ -346,7 +353,7 @@ public function draw($text)
// Print Check Digit
- imagestring(
+ $this->writer->imagestring(
$img,
$this->_font,
$xpos + 1,
Please sign in to comment.
Something went wrong with that request. Please try again.