Skip to content

Commit ead13d1

Browse files
Miquel MartínMiquel Martín
authored andcommitted
Implement 'new QrReader()' from from blob image
1 parent f4d5093 commit ead13d1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/QrReader.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
include_once ('common/HybridBinarizer.php');
4747

4848

49-
final class QrReader
49+
final class rR
5050
{
5151
const SOURCE_TYPE_FILE = 'file';
5252
const SOURCE_TYPE_BLOB = 'blob';
@@ -63,6 +63,7 @@ function __construct($imgsource, $sourcetype = 'file')
6363
$im->readImage($imgsource);
6464
}else {
6565
$image = file_get_contents($imgsource);
66+
$im = imagecreatefromstring($image);
6667
}
6768

6869
break;
@@ -72,7 +73,7 @@ function __construct($imgsource, $sourcetype = 'file')
7273
$im = new Imagick();
7374
$im->readimageblob($imgsource);
7475
}else {
75-
$image = $imgsource;
76+
$im = imagecreatefromstring($imgsource);
7677
}
7778

7879
break;
@@ -83,11 +84,8 @@ function __construct($imgsource, $sourcetype = 'file')
8384
$height = $im->getImageHeight();
8485
$source = new \Zxing\IMagickLuminanceSource($im, $width, $height);
8586
}else {
86-
$sizes = getimagesize($imgsource);
87-
$width = $sizes[0];
88-
$height = $sizes[1];
89-
$im = imagecreatefromstring($image);
90-
87+
$width = imagesx($im);
88+
$height = imagesy($im);
9189
$source = new \Zxing\GDLuminanceSource($im, $width, $height);
9290
}
9391
$histo = new \Zxing\Common\HybridBinarizer($source);

0 commit comments

Comments
 (0)