이미지 LoadPicture() 함수를 이용한 리사이징 > 소스코드

본문 바로가기
사이트 내 전체검색


회원로그인

소스코드

asp | 이미지 LoadPicture() 함수를 이용한 리사이징

페이지 정보

작성자 100K5 작성일14-07-07 21:12 조회57,667회 댓글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%>" >

댓글목록

등록된 댓글이 없습니다.


사이트소개 개인정보취급방침 서비스이용약관 Copyright © kkujunhee.net All rights reserved.
상단으로

개인정보관리책임자 : 관리자

모바일 버전으로 보기