Skip to content

Instantly share code, notes, and snippets.

@tomek-f
Created June 10, 2020 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomek-f/b714e3b55d27d803998aa9843266c555 to your computer and use it in GitHub Desktop.
Save tomek-f/b714e3b55d27d803998aa9843266c555 to your computer and use it in GitHub Desktop.
const { height, width } = await new Promise(resolve => {
const fr = new FileReader();
fr.onload = () => {
const img = new Image();
img.onload = () => {
resolve({ width: img.width, height: img.height });
};
img.src = fr.result;
};
fr.readAsDataURL(file);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment