LazarSoft / jsqrcode

Javascript QRCode scanner
http://www.webqr.com
Apache License 2.0
3.96k stars 1.16k forks source link

Issue on iphone 4 #27

Open momohuri opened 10 years ago

momohuri commented 10 years ago

Hi, I've tried to use this library on iphone and it never succeed to analyse the qr code.

nothing bad is happening, and the library return a result, but the result is always the same: error decoding QR Code

I used the same code and same image on firefox on my pc and it work fine.

the code is the folowing :

        var file = e.currentTarget.files[0];//  this is my image
        var reader = new FileReader();

        reader.onload = function (e) {
            var dataURL = reader.result;
            qrcode.decode(dataURL);
        }

        qrcode.callback = function (data) {
            alert(data)
        }

        reader.readAsDataURL(file);

Thanks

daisylb commented 10 years ago

Safari on iOS doesn't support either Flash or the getUserMedia API, as far as I can tell. I suspect that this issue is unfixable until it does.

mwalles2 commented 10 years ago

I'm having a similar issue. It is not with getUserMedia. I am using a file chooser to select the QR code to be read. I have an image that works fine on my computer, but on my phone (iPhone 5s, iOS 7) I have to rotate the image to the correct orientation or else it throws the exception "Couldn't find enough finder patterns" in findpat.js line 394. The exception is being thrown because startSize = 0.

Maniak82 commented 10 years ago

I'm also having similar issue on iPhone 4s with iOS 7. Every time I try to scan a QR Code (previously taken with the iPhone camera), I have "error decoding QR Code" error. When I try to to decode the same QR Code, same image file, on my PC with Firefox it's work fine.

Also, if I re-save the image directly on my iPhone (by doing dummy image editing..) then QR code scan works for that image.

I have also tested, on my iPhone, with image downloaded from some web QR Code generator, works fine.

I think the problem may come from the manner the image is saved on iPhone, peraps an iOS 7 related problem, because I have had no problem with an iPad on iOS 6...

Would be great If someone could provide some help !

Maniak82 commented 10 years ago

For those still having this issue, I have found a solution here : http://stackoverflow.com/a/17086329 The problem is due to some iOS bug, the image taken by camera have wrong dimensions and need to be resized before the QR code decode call...