How can I fix the EXIF orientation in Angular 2? I am loading an image from mobile and I need to fix the orientation.
I have tried the solution for this post: Component inputs by reference but FileReaderEvent type is not recognised by typescript, EXIF does not exist, and I can't access to 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])
}
}