본문으로 바로가기

<%
IMG_file = server.mappath(".") & "\box.jpg"
imag_size = ImgFunction(IMG_file)
imag_size = Split(imag_size,",")
response.write ("넓이 " & imag_size(0))
response.write "<br>"
response.write ("높이 " & imag_size(1))
%>


---------------------------------------------------

출력화면


넓이 213
높이 114




--------------------------------------------------------

<%
Function ImgFunction(IMG_file)
Const limitWidth=600
dim orgWidth,orgHeight
dim newWidth,newHeight

Set objImg = LoadPicture(IMG_file)
orgWidth = cint(objImg.Width * 24 / 635)
orgHeight = cint(objImg.Height * 24 / 635)
if limitWidth < orgWidth then
  newWidth = limitWidth
  newHeight = orgHeight * (limitWidth / orgWidth)
else
  newWidth = orgWidth
  newHeight = orgHeight
End if
ImgFunction = orgWidth & "," & orgHeight
End Function
%>


자바스크립트

var img = new Image()

    img.src="경로";

    alert(img.width);