From b562ef343d5f38095546875efa2d5f1621c386b2 Mon Sep 17 00:00:00 2001 From: Rob Gridley Date: Thu, 18 Feb 2016 17:07:27 -0500 Subject: [PATCH] Another minor refactor for clarity --- src/Zpl/Image.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Zpl/Image.php b/src/Zpl/Image.php index 9a5c6d2..771ee0c 100644 --- a/src/Zpl/Image.php +++ b/src/Zpl/Image.php @@ -115,23 +115,23 @@ protected function encode() { $bitmap = null; - for ($row = 0; $row < $this->height; $row++) { + for ($y = 0; $y < $this->height; $y++) { $bits = null; - for ($column = 0; $column < $this->width; $column++) { - $bits .= (imagecolorat($this->image, $column, $row) & 0xFF) < 127 ? '1' : '0'; + for ($x = 0; $x < $this->width; $x++) { + $bits .= (imagecolorat($this->image, $x, $y) & 0xFF) < 127 ? '1' : '0'; } $bytes = str_split($bits, 8); $bytes[] = str_pad(array_pop($bytes), 8, '0'); - $ascii = null; + $row = null; foreach ($bytes as $byte) { - $ascii .= sprintf('%02X', bindec($byte)); + $row .= sprintf('%02X', bindec($byte)); } - $bitmap .= $this->compress($ascii); + $bitmap .= $this->compress($row); } return $bitmap;