Skip to content

Commit

Permalink
chore(release): bump version number to 10.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
harryy committed Feb 22, 2018
1 parent c4d0f89 commit 5a40049
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<a name="10.13.0"></a>
# [10.13.0](https://github.com/harryy2510/ngx-img/compare/v10.12.0...v10.13.0) (2018-02-22)



<a name="10.12.0"></a>
# [10.12.0](https://github.com/harryy2510/ngx-img/compare/v10.11.0...v10.12.0) (2018-02-22)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ngx-img",
"description": "Angular Image Upload &amp; Crop",
"version": "10.12.0",
"version": "10.13.0",
"filename": "./src/ngx-img.js",
"homepage": "http://github.com/harryy2510/ngx-img",
"author": {
Expand Down
43 changes: 24 additions & 19 deletions src/module/component/ngx-img.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class NgxImgComponent implements OnInit, OnDestroy {
errors: any = [];
file: any;
mode = 'upload';
@Output() onChange: EventEmitter<any> = new EventEmitter();
@Output() onSelect: EventEmitter<any> = new EventEmitter();
@Output() onReset: EventEmitter<any> = new EventEmitter();

Expand Down Expand Up @@ -128,26 +129,30 @@ export class NgxImgComponent implements OnInit, OnDestroy {
return false;
}

this.isLoading = true;
const reader: FileReader = new FileReader();
reader.onloadend = (ev: any) => {
this.imgSrc = ev.target.result;
this.fileName = this.file.name;
this.hasPreview = true;
this.isLoading = false;
if (this._config.crop) {
this.mode = 'crop';
} else {
this._service.compress(this.imgSrc, this._config).then((res: any) => {
this.onSelectEvent(res);
})
.catch(() => {
this.onSelectEvent(this.imgSrc);
});
}
};
reader.readAsDataURL(this.file);
this.fileName = this.file.name;
this.onChange.emit(this.file);

if (this.file.type.split('/')[0] === 'image') {
this.isLoading = true;
const reader: FileReader = new FileReader();
reader.onloadend = (ev: any) => {
this.imgSrc = ev.target.result;
this.fileName = this.file.name;
this.hasPreview = true;
this.isLoading = false;
if (this._config.crop) {
this.mode = 'crop';
} else {
this._service.compress(this.imgSrc, this._config).then((res: any) => {
this.onSelectEvent(res);
})
.catch(() => {
this.onSelectEvent(this.imgSrc);
});
}
};
reader.readAsDataURL(this.file);
}
}

reset() {
Expand Down

0 comments on commit 5a40049

Please sign in to comment.