diff --git a/README.md b/README.md index 3c15f83..6b724c0 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,20 @@ -#php qr decoder -> php识别二维码, 不需要安装扩展 从哪里弄来的我也忘了,毕竟好几年了 +## PHP QR Decoder -### 安装 -`composer require zxing/qr-reader` +### How to install +`composer require thiagolp90/qr-reader` -### 使用 +> this package is a fork of `zxing/qr-reader` to fix a bug when reading file using GD + +### How to use ``` include __DIR__.'/vendor/autoload.php'; -$qrcode = new \Zxing\QrReader('./qr.png'); //图片路径 -$text = $qrcode->text(); //返回识别后的文本 +$qrcode = new \Zxing\QrReader('./qr.png'); //Image path +$text = $qrcode->text(); //Return text echo $text; ``` -### 需要 +### Requirements ``` PHP >= 5.3 GD Library diff --git a/composer.json b/composer.json index 3e60bb7..3ded10a 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "zxing/qr-reader", + "name": "thiagolp90/qr-reader", "description": "PHP qr code reader library", "keywords": [ "php", diff --git a/lib/GDLuminanceSource.php b/lib/GDLuminanceSource.php index 9b9b9af..af872be 100644 --- a/lib/GDLuminanceSource.php +++ b/lib/GDLuminanceSource.php @@ -51,7 +51,7 @@ public function GDLuminanceSource($gdImage, $width, $height) $this->dataHeight = $height; $this->left = 0; $this->top = 0; - $this->$gdImage = $gdImage; + $this->gdImage = $gdImage; // In order to measure pure decoding speed, we convert the entire image to a greyscale array @@ -64,8 +64,8 @@ public function GDLuminanceSource($gdImage, $width, $height) for($j=0;$j<$height;$j++){ for($i=0;$i<$width;$i++){ - $argb = imagecolorat($this->$gdImage, $i, $j); - $pixel = imagecolorsforindex($this->$gdImage, $argb); + $argb = imagecolorat($this->gdImage, $i, $j); + $pixel = imagecolorsforindex($this->gdImage, $argb); $r = $pixel['red']; $g = $pixel['green']; $b = $pixel['blue'];