qr-code-reader icon indicating copy to clipboard operation
qr-code-reader copied to clipboard

Undefined offset: 1 $QRCodeReader->decode(base64_encode

Open zanjs opened this issue 8 years ago • 2 comments

$content = $this->qrcode($token,$path.$id);

$QRCodeReader = new QRCodeReader();
$qrcode_text = $QRCodeReader->decode(base64_encode($content));

var_dump($qrcode_text);

_20170718222801

zanjs avatar Jul 18 '17 14:07 zanjs

is un error in te file ../lib/QrReader.php in the line 61 inner file , the solution is add this extra prosess:

for($i=0;$i<count($imageDetails);$i++)
                {
                    if(preg_match("/^[0-9]+(x)[0-9]+$/",trim($imageDetails[$i]))>0){
                        $imageSize = explode('x', trim($imageDetails[$i]))  ;
                        break;
                    }
                }

also the call function $QRCodeReader->decode(base64_encode($content)); is

$QRCodeReader = new \Libern\QRCodeReader\QRCodeReader();
        $qrcode_text = $QRCodeReader->decode($request->input('img'));
        return \Response::json($qrcode_text);

example

image (example convert in base64)

Imgur

code

Imgur

execution

NOTE: the execution is by web API with base64 imag, call with "REST CLIENT" from google chrome

yorb1990 avatar May 03 '18 21:05 yorb1990

A pull request is welcome :)

libern avatar May 07 '18 03:05 libern