업로드된 이미지 또는 원하는 이미지의 경로와 원하는 가로/세로 사이즈를 지정하여 썸네일 이미지를 생성하고

그 경로를 리턴해주는 함수

 

<%
'img_path : 이미지가 저장된 절대 경로
'img_name : 이미지 파일명
'thumb_name : 원하는 썸네일명
'thumb_wsize : 썸네일 가로 사이즈
'thumb_hsize : 썸네일 세로 사이즈
'리턴값 : 생성된 썸네일 파일 경로
Function makeThumbnail(ByVal img_path, ByVal img_name, ByVal thumb_name, ByVal thumb_wsize, ByVal thumb_hsize)
     Dim thumb_path, thumb_image, objImage
 
     '썸네일 이미지 생성
     Set objImage = Server.CreateObject("DEXT.ImageProc")
     IF objImage.SetSourceFile(img_path &"\"& img_name) Then
          thumb_path = img_path &"\"& thumb_name &".png"
          thumb_image = objImage.SaveasThumbnail(thumb_path, thumb_wsize, thumb_hsize, true)
     End IF
 
     makeThumbnail = thumb_image
End Function
 
Response.Write makeThumbnail(Server.MapPath("/images/"), "dev_logo.gif", "thumbnail", 40, 40)
%>