Created
May 5, 2020 16:59
-
-
Save renzhezhilu/6965e784799ffb5d190c14a4c44d9b12 to your computer and use it in GitHub Desktop.
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
// 获取图片的宽和高 | |
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