Created
October 27, 2020 07:47
-
-
Save almond-bongbong/7ee93b56ef705569a032de4c47b342c2 to your computer and use it in GitHub Desktop.
Transform orientation file object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const transformOrientationFile = (file: File): Promise<File> => ( | |
new Promise<File>(((resolve) => { | |
loadImage(file, (img) => { | |
(img as HTMLCanvasElement).toBlob((blob) => { | |
if (blob) { | |
const newFile = new File([blob], file.name, { ...file }); | |
resolve(newFile); | |
} | |
}, file.type); | |
}, | |
{ | |
canvas: true, | |
orientation: true, | |
maxWidth: 2000, | |
}); | |
})) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment