Closed nicolaspernoud closed 4 years ago
I retried with an even simpler project (no material), and the problem was the same (on firefox 69 and MS Edge).
Error stack : "ReferenceError: Variable undefined in strict mode at getStringFromDB (http://localhost:4200/vendor.js:83609:14) at readEXIFData (http://localhost:4200/vendor.js:83616:9) at findEXIFinJPEG (http://localhost:4200/vendor.js:83317:17) at handleBinaryFile (http://localhost:4200/vendor.js:83238:13) at fileReader.onload (http://localhost:4200/vendor.js:83259:21) at ZoneDelegate.prototype.invoke (http://localhost:4200/polyfills.js:3593:13) at onInvoke (http://localhost:4200/vendor.js:70641:17) at ZoneDelegate.prototype.invoke (http://localhost:4200/polyfills.js:3593:13) at Zone.prototype.runGuarded (http://localhost:4200/polyfills.js:3369:21) at Anonymous function (http://localhost:4200/polyfills.js:3353:17)"
Could someone have a look ?
home.component.ts :
import { Component, EventEmitter } from '@angular/core';
import { NgxPicaService, NgxPicaErrorInterface } from '@digitalascetic/ngx-pica';
@Component({
selector: 'app-home',
template: `
<img *ngFor="let image of images" [src]="image" />
<input type="file" accept="image/png, image/jpeg" multiple
(change)="handleFiles($event)">
`
})
export class AppHomeComponent {
images: File[] = [];
constructor(private _ngxPicaService: NgxPicaService) {
}
public handleFiles(event: any) {
const files: File[] = event.target.files;
this._ngxPicaService.resizeImages(files, 1200, 880)
.subscribe((imageResized: File) => {
let reader: FileReader = new FileReader();
reader.addEventListener('load', (event: any) => {
this.images.push(event.target.result);
}, false);
reader.readAsDataURL(imageResized);
}, (err: NgxPicaErrorInterface) => {
throw err.err;
});
}
}
package.json :
{
"name": "pica-test",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.4",
"@angular/common": "~8.2.4",
"@angular/compiler": "~8.2.4",
"@angular/core": "~8.2.4",
"@angular/forms": "~8.2.4",
"@angular/platform-browser": "~8.2.4",
"@angular/platform-browser-dynamic": "~8.2.4",
"@angular/router": "~8.2.4",
"@digitalascetic/ngx-pica": "^8.0.2",
"exif-js": "^2.3.0",
"pica": "^5.1.0",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.2",
"@angular/cli": "~8.3.2",
"@angular/compiler-cli": "~8.2.4",
"@angular/language-service": "~8.2.4",
"@types/node": "~8.9.4",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
Install sequence :
ng new pica-test
npm install @digitalascetic/ngx-pica --save
npm install pica@^5.1.0
npm install exif-js@^2.3.0
It was a strange exif-js problem. The 2.3.0 release is flawed on npm.
This fixed it : npm install https://github.com/exif-js/exif-js instead
of npm install exif-js
...
The error is at line 741 of exif.js (for (var n = start; n < start+length; n++) {)
It was a strange exif-js problem. The 2.3.0 release is flawed on npm. This fixed it :
npm install https://github.com/exif-js/exif-js instead
ofnpm install exif-js
... The error is at line 741 of exif.js (for (var n = start; n < start+length; n++) {)
Thanks. It's work.
After creating a brand new project with
ng new
installing ngx-pica and creating a component with the example code provided in the readme.md, I get an error :Package.json is below :