EddieLa / JOB

A Barcode scanner capapable of reading Code128, Code93, Code39, Standard/Industrial 2 of 5, Interleaved 2 of 5, Codabar and EAN-13 barcodes in javascript.
http://eddiela.github.io/JOB
600 stars 204 forks source link

Uncaught TypeError: Cannot set property 'width' of null #30

Closed igorissen closed 9 years ago

igorissen commented 9 years ago

Hi,

I just found your library and when I try to test it with an image I got the error in the subject. I want to add it in my AngularJS application.

function setFiles(element) {
  var showPicture = document.createElement("img");

  console.log(element.files);

  var URL = window.URL || window.webkitURL;
  showPicture.onload = function (event) {
    JOB.DecodeImage(showPicture);
    URL.revokeObjectURL(showPicture.src);
  };

  showPicture.src = URL.createObjectURL(element.files[ 0 ]);
}

JOB.SetImageCallback(function (result) { console.log(result); });

Any idea ?

Thanks.

igorissen commented 9 years ago

I found my mistake. I'm calling JOB.init(); instead of JOB.Init();. Now my code is working great.

Thanks for your work.