asp | 이미지 LoadPicture() 함수를 이용한 리사이징
페이지 정보
작성자 100K5 작성일14-07-07 21:12 조회58,151회 댓글0건관련링크
본문
<%
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If fso.FileExists(physical_path & "upload\appendFile\" & 저장파일명) Then
set imgSize = LoadPicture(physical_path & "upload\appendFile\" & 저장파일명) ' 절대경로 필수
request_w = 200
request_h = 150
ImageWidth = Round(((imgSize.Width)*24/635)) ' 원본이미지 폭
ImageHeight = Round(((imgSize.Height)*24/635)) ' 원본이미지 높이
if ImageWidth > request_w or ImageHeight > request_h then ' 원본 이미지 가로 사이즈가 지정 가로 사이즈 보다 크거나 원본 이미지 가로 사이즈가 지정 가로 사이즈 보다 큰경우
if ImageWidth > ImageHeight then ' 원본 이미지 가로 사이즈가 원본 세로 사이즈 보다 클 경우
resizeWidth = request_w ' 생성 이미지 가로 = 지정 사이즈
resizeHeight = ImageHeight * request_w / ImageWidth ' 생성 이미지 세로 = 원본 이미지 세로 사이즈 * 지정 가로 사이즈 / 원본 가로 사이즈
if resizeHeight > request_h then
resizeWidth = request_h * ImageWidth / ImageHeight
resizeHeight = request_h
End If
Else
resizeHeight = request_h
resizeWidth = ImageWidth * request_h / ImageHeight
if resizeWidth > request_w then
resizeWidth = request_w
resizeHeight = request_w * ImageHeight / ImageWidth
End If
End If
Else
resizeWidth = ImageWidth
resizeHeight = ImageHeight
End If
End If
Set fso = Nothing
%>
<img src="/upload/appendFile/저장파일명" width="<%=resizeWidth%>" height="<%=resizeHeight%>" >
댓글목록
등록된 댓글이 없습니다.