exif-js / exif-js

JavaScript library for reading EXIF image metadata

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

n is not defined

cleverboy32 opened this issue · comments

commented
function getStringFromDB(buffer, start, length) {
        var outstr = "";
        for (var n = start; n < start+length; n++) {
            outstr += String.fromCharCode(buffer.getUint8(n));
        }
        return outstr;
    }

why in node_modules its changeTo

function getStringFromDB(buffer, start, length) {
        var outstr = "";
        for (n = start; n < start+length; n++) {
            outstr += String.fromCharCode(buffer.getUint8(n));
        }
        return outstr;
    }

and in strict mode error。。。 can fix this ???

Hi,
same issue with angular 8 only when I try to resize a picture made by screenshot with MAC OS.

packages
"exif-js": "^2.3.0",
"@digitalascetic/ngx-pica": "^8.0.1",
"blueimp-canvas-to-blob": "^3.14.0",
"pica": "^5.1.0",

code

this.subscriptions
        .add(
          this._ngxPicaService
            .resizeImages(files, 400, 300, options)
            .pipe(
              take(1)
            ).subscribe((imageResized: File) => {
              this.filePicture = imageResized;
              this.getImagePreview(imageResized);
            }, (err: NgxPicaErrorInterface) => {
              throw err.err;
            }));

Error

core.js:6014 ERROR ReferenceError: n is not defined
    at getStringFromDB (exif.js:741)
    at readEXIFData (exif.js:748)
    at findEXIFinJPEG (exif.js:449)
    at handleBinaryFile (exif.js:370)
    at FileReader.fileReader.onload (exif.js:391)
    at ZoneDelegate.invoke (zone-evergreen.js:359)
    at Object.onInvoke (core.js:39698)
    at ZoneDelegate.invoke (zone-evergreen.js:358)
    at Zone.runGuarded (zone-evergreen.js:134)
    at FileReader.<anonymous> (zone-evergreen.js:118)

Thank you for your help

image
同样的问题,请问有解决办法了么

For the benefit of anyone searching for the "n is not defined" message, it has been fixed but not published to npm. Some forks have been published, or you can just install directly from GitHub with the following command.

npm install https://github.com/exif-js/exif-js.git

#238 (comment)