이미지 파일의 width, height 구하기

function getImageSize (url) {
  return new Promise((resolve, reject) => {
    let image = new Image()
    image.onload = () => {
      resolve({
        width: image.naturalWidth,
        height: image.naturalHeight
      })
    }
    image.src = url
  })
}

예제

See the Pen get image size by gloria (@gloriaJun) on CodePen.