Web Programing!/Script
[Javascript] 이미지 URL로 width, height 구하기
어설픈봉봉이
2024. 7. 12. 11:33
반응형
SMALL
const img = new Image();
img.src = 'url';
img.onload = function() {
const imgWidth = img.naturalWidth;
const imgHeight = img.naturalHeight;
console.log('imgWidth: ', imgWidth);
console.log('imgHeight: ', imgHeight);
};
반응형