How can I fix the EXIF orientation in Angular 2? I upload an image from a mobile, and I need to fix the orientation.
I tried the solution for this post: Component inputs by reference
but the FileReaderEvent type is not recognized by typescript, EXIF does not exist, and I cannot access the imageRotateDegrees, ImageExifRotation properties ....
This is my code:
imageChange(input){
if (input.files.length > 0) {
var img = document.createElement("img");
img.src = window.URL.createObjectURL(input.files[0]);
// Create a FileReader
var reader = new FileReader();
var self = this;
reader.onload = function (e: any) {
img.onload = function() {
var resizedImg = self.resize(img);
self.model.base64Image = resizedImg;
self.picture = resizedImg;
}
img.src = e.target.result;
}
reader.readAsDataURL(input.files[0])
}
}
source
share