Skip to content

Instantly share code, notes, and snippets.

@renzhezhilu
Created May 5, 2020 16:59
Show Gist options
  • Save renzhezhilu/6965e784799ffb5d190c14a4c44d9b12 to your computer and use it in GitHub Desktop.
Save renzhezhilu/6965e784799ffb5d190c14a4c44d9b12 to your computer and use it in GitHub Desktop.
// 获取图片的宽和高
function getImagesWidthHeight(url = "blob | base64 | url") {
return new Promise((ret) => {
let img = new Image()
img.src = url
img.onload = function() {
ret({
width: this.width,
height: this.height,
image: this
})
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment