Closed sarath3940 closed 6 years ago
Hi! Try this
<input type="file" accept="image/jpeg, image/png" />
In some browsers it does not usually work, in the next version I will add a filter.
Yes, I have tried this. What's happening is, we can't see the .gif format file's while selecting the image in File Explorer(because we have customized the file format that should be displayed). But, if we select "All Files", and if we select a .gif file, it is getting loaded. I don't want that to happen. Is their any solution. Please let me know!!
Replace cropping.selectInputEvent($event)
to filterFormat($event)
...
<input #_fileInput type="file" (change)="filterFormat($event)" accept="image/*">
...and create filter...
...
export class myComponent {
...
@ViewChild(LyResizingCroppingImages) img: LyResizingCroppingImages;
filterFormat(event) {
const acceptableFormats = ['image/jpeg', 'image/png'];
const type = event.target.files[0].type;
if (acceptableFormats.some((format) => format === type)) {
this.img.selectInputEvent(event);
} else {
console.log('format not acceptable...');
}
}
}
Thank you once again. It work's.
Hi there. As if now, the cropper is accepting ".gif" format as well. I don't want that to happen. What should I do?