This file contains hidden or 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
// Based on: https://stackoverflow.com/a/46814952/283851 | |
// Based on: https://gist.github.com/mindplay-dk/72f47c1a570e870a375bd3dbcb9328fb | |
/** | |
* Create a Base64 Image URL, with rotation applied to compensate for EXIF orientation, if needed. | |
* | |
* Optionally resize to a smaller maximum width - to improve performance for larger image thumbnails. | |
*/ | |
export function getImageUrl(file: File, maxWidth: number|undefined): Promise<string> { | |
return readOrientation(file).then(orientation => { |