angular2-img-cropper
angular2-img-cropper copied to clipboard
How to upload the image on click canvas area instead of speared upload button
How to upload the image on click canvas area instead of speared upload button,
is it possible can bring in this plugin as per below image, i can able to onclick upload dialog opening but i stuck in drag and drop functionality.
do you still need help?
yes, @web-dave
how do you trigger the input dialog?
<input *ngIf="!settings.noFileInput" #fileInput type="file" accept="image/*" (change)="fileChangeListener($event)">
and in the onMouseDown
@ViewChild("fileInput") fileInput: ElementRef;
public onMouseDown(event: MouseEvent): void {
this.cropper.onMouseDown(event);
if (!this.cropper.isImageSet() && !this.settings.noFileInput) {
// load img
this.fileInput.nativeElement.click();
}
}
That's one way. but I'll test it tonight.
Hi @web-dave , i got error:
[ts] Property 'isImageSet' does not exist on type 'ImageCropperComponent'.
I am using "ng2-img-cropper": "^0.8.6",