• ÇÁ¸®Ä«¿îÅÍ
  • Ç÷¡½ÃºÏ
  • ÇÁ¸®º¸µå
  • Àü±¤ÆÇ
  • À¥°øºÎ¹æ
  • Ä¿¹Â´ÏƼ
[asp] ½æ³×ÀÏ 2008.07.10 22:27
±Û¾´ÀÌ : ¿î¿µÀÚ Á¶È¸ : 1504 Ãßõ : 4
¾È³çÇϽɱî? 
¸¹Àº ºÐµéÀÌ asp¸¦ ÅëÇØ ½æ³×ÀÏÀ» ±¸ÇöÇÏ°íÀÚ ³ë·ÂÇϽôµ¥
¾Ö¼®ÇÏ°Ôµµ ¾ÆÁ÷ asp¿¡´Â ½æ³×ÀÏÀÌ ¾ø°Å³ª ÀÖ´Â °Í ¿ª½Ã ¸ðµÎ À¯·á¶ó
»ç¿ëÀ» ²¨¸®°í °è½Å °ÍÀ¸·Î ¾Ë°í ÀÖ½À´Ï´Ù.
¾ó¸¶Àü ÄÚµåÇÁ·ÎÁ§Æ® ȨÆäÀÌÁö¸¦ ÅëÇØ ¿ì¿¬È÷ ½æ³×ÀÏÀÌ ±¸ÇöµÈ °ÍÀ» º¸°í
¹Ý°©°íµµ ÁÁÀº Á¤º¸¶ó ÀÌ°÷¿¡ ¿Ã¸³´Ï´Ù.
ÀÚ¼¼ÇÑ ³»¿ëÀº Á÷Á¢ È®ÀÎÇØ º¸½Ãµµ·Ï!!

ÀÌ ¼¶³×ÀÏÀº ¹«·á À̹ÌÁö ÄÞÆ÷³ÍÆ®ÀÎ Cximage.dll À» ÀÌ¿ëÇØ ±¸Çö Çϼ̴õ±º¿ä.
Cximage.dll Àº ÄÚµå ÇÁ·ÎÁ§Æ® ȨÀ̳ª Á¦ÀÛÀÚÀÇ È¨ÀÎ http://www.aoi.it ¿¡¼­
´Ù¿î ¹ÞÀ¸½Ç ¼ö ÀÖ½À´Ï´Ù.´Ù¿î ¹ÞÀ¸¼Å¼­ Cximage.dll À» ·¹Áö½ºÆ®¸®¿¡ µî·ÏÇϽñ¸¿ä


Cximage°¡ °ÅÀÇ ¸ðµç ±×¸²ÆÄÀÏÀ» °Çµå¸± ¼ö Àֱ⠶§¹®¿¡ ´ç±Ù ÀÌ ¼¶³×ÀÏ¿ª½Ã °ÅÀÇ ¸ðµç ±×¸²ÆÄÀÏ¿¡
Àû¿ëÇÏ½Ç ¼ö ÀÖÀ» °Ì´Ï´Ù.


À½~~ ¾ÆÁ÷µµ ¹ÏÁö ¸øÇϽô ºÐÀÌ...
¿¹Á¦ ¼Ò½º º¸¿© µå¸³´Ï´Ù.
Á¦ ÄÄÀ̴ϱî ÇØÅ·ÇÒ »ý°¢ ¸¶½Ã±¸¿ä (¾Ï°ÍµÎ ¾ø½À´Ï´Ù.) Á¢¼Ó¾ÈµÉ¶§´Â ²¨ ÀÖÀ» ¶§ ÀÔ´Ï´Ù.
http://218.52.60.92/Thumbnail/Thumbasp/work.asp
¿©±â¼­ È®ÀÎÇØ º¸¼¼¿ä.

±×·³ ¼Ò½º ³ª°©´Ï´Ù.!!!!


1. ListThumbs.inc ÆÄÀÏ
<%
Function IsFileOfType(afile,infile_type)
IsFileOfType = (UCase(Right(afile,Len(infile_type)))=UCase(infile_type))
End Function

Sub WriteGotoPageScript
Response.Write "<script language=""javascript"">" & vbCrLf & _
"//<!--" & vbCrLf & "function GoToPage(vpath,n) { " & vbCrLf & _
"document.forms(0).hdnCurPage.value=n;" & vbCrLf & _
"document.forms(0).submit(); " & vbCrLf & _
"}" & vbCrLf & "//-->" & vbCrLf & "</" & "script>" & vbCrLf
End Sub

Function ListThumbs
(VPath,Columns,Filter,AllowPaging,PageSize,Width,Height,Quality,AllowStretch,ShowFilenames,ShellThumbnail
s)
Set fso = CreateObject("Scripting.FileSystemObject")
Set ScriptName = Request.ServerVariables("SCRIPT_NAME")
ScriptPath = Left(ScriptName,InstrRev(ScriptName,"/"))
If Right(VPath,1)<>"/" Then VPath=VPath & "/"
path = Server.MapPath(VPath): If Right(path,1)<>"" Then path=path & ""
' analyze filter string
If Len(Filter)=0 Then Filter = "*.gif;*.jpg;*.bmp"
arSuffixes = Split(Filter,";")
For i=0 To UBound(arSuffixes)
pos=Instr(1,arSuffixes(i),".")
If pos>0 Then arSuffixes(i) = Mid(arSuffixes(i),pos) ' e.g. ".gif"
Next
Dim CurPage,TotalPages
' -- write client script and hidden field for current page and path
If AllowPaging Then Call WriteGotoPageScript
If Len(Request.Form("hdnCurPage"))>0 Then
CurPage = CInt(Request.Form("hdnCurPage"))
Else CurPage=1
End If
Response.Write "<input type='hidden' name='hdnCurPage' value='" & CurPage & "' />" & vbCrLf
If Request.Form("hdnPrevPath")<> VPath Then CurPage = 1 ' restart page numbering
Response.Write "<input type='hidden' name='hdnPrevPath' value='" & VPath & "' />" & vbCrLf

Dim arrFilesAll(),ubn
If fso.FolderExists(path) Then
Set oFolder = fso.GetFolder(path)
For Each oFile in oFolder.Files
bFileInFilter=False
For i=0 To UBound(arSuffixes)
If IsFileOfType(oFile.Name,arSuffixes(i)) Then bFileInFilter=True
Next
If bFileInFilter Then
ReDim Preserve arrFilesAll(ubn)
arrFilesAll(ubn) = oFile.Name
ubn=ubn+1
End If ' if in filter
Next
End If

If AllowPaging Then
TotalPages = CInt(ubn/PageSize)
If ubn Mod PageSize>0 Then TotalPages = TotalPages + 1
if TotalPages=0 Then TotalPages=1
' make sure current page is in the [1,totalPages] range
if CurPage>TotalPages Then
CurPage=TotalPages
else
if CurPage<1 Then CurPage=1
end if
' range of files to read
StartIndex = (CurPage-1)*PageSize
EndIndex = CurPage*PageSize
If ubn < EndIndex Then EndIndex = ubn
Else
StartIndex = 0: EndIndex = ubn
End If
' write thumbnail hrefs
If fso.FolderExists(path) Then
Response.Write "<TABLE ALIGN='CENTER'>" & vbCrLf
For index=StartIndex To EndIndex-1
FileName = arrFilesAll(index)
' Response.write path & FileName
Set oFile=fso.GetFile(path & FileName) : FileSize=oFile.Size
nCol = nCol+1
VFilePath = VPath & FileName
sHREF = "<a href='" & VFilePath & "'>" & _
"<img src='" & ScriptPath & "ThumbGenerate.asp?VFilePath=" & _
Server.URLEncode(VFilePath) & "&Width=" & Width & "&Height=" & Height & "&Quality=" & Quality & _
"&ShellThumbnails=" & ShellThumbnails & "&AllowStretch=" & AllowStretch & _
"' border=0 alt='Name: " & FileName & "&#10;&#13;Size: " & CInt(FileSize/1024) & " Kb'/> </a>"
If nCol = 1 Then Response.Write "<TR>"
Response.Write "<TD align='Center' style='background-color:White;border-width:1px;border-
style:Solid;font-size:8pt;'>" & vbCrLf
Response.Write sHREF & vbCrLf
If ShowFilenames Then Response.Write "<br/>" & FileName
Response.Write "</TD>" & vbCrLf
If nCol = Columns Then
Response.Write "</TR>" & vbCrLf
nCol = 0
End If
Next
Response.Write NumImagesDisplayed(EndIndex-StartIndex,AllowPaging,ubn,CurPage,TotalPages)
If AllowPaging Then
Response.Write CreateNavBar(VPath,CurPage,TotalPages,Columns)
End If
Response.Write "</TABLE>" & vbCrLf
Else
Response.Write "Directory Does Not Exist<P>" & vbCrLf
End If
End Function

Function NumImagesDisplayed(NumDisplayed,AllowPaging,TotalFiles,CurPage,TotalPages)
s = "<tr><td align='Center' colspan='" & Columns & "' style='background-color:#FFFFC0;font-size:8pt;'>"
s = s & NumDisplayed
if AllowPaging Then s = s & " of " & TotalFiles
s = s & " thumbnails"
if AllowPaging Then
s = s & " (Page " & CurPage & " of " & TotalPages & ")"
end if
s = s & "</td></tr>"
NumImagesDisplayed = s
End Function

Function CreateNavBar(VPath,CurPage,TotalPages,Columns)
if TotalPages = 1 Then Exit Function
s = "<tr><td align='Center' colspan='" & Columns & "' style='font-size:8pt;'>"
if CurPage>1 Then
'GoToPage client script updates hidden field with target page
'and then causes a postback
s = s & "<A href=""javascript:GoToPage('" & VPath & "'," & CurPage-1 & _
");"">&lt;&lt; Prev</A>&nbsp;&nbsp;"
End If
for i=1 To TotalPages
if i=CurPage Then
s = s & "<b>" & i & "</b>"
else
s = s & "<A href=""javascript:GoToPage('" & VPath & "'," & i & ");"">" & _
i & "</A>"
end if
s = s & "&nbsp;"
If i Mod 10=0 Then s = s & "<br/>"
Next
If CurPage<TotalPages Then
s = s & "&nbsp;<A href=""javascript:GoToPage('" & VPath & "'," & CurPage+1 & _
");"">Next &gt;&gt;</A>&nbsp;&nbsp;"
End If
s = s & "</td></tr>"
CreateNavBar = s
End Function

%>

2. ThumbGenerate.asp ÆÄÀÏ


<%
Set fso = Server.CreateObject("Scripting.FileSystemObject")

Response.ContentType = "image/jpeg"
' ---- parameter parsing ----'
Dim VFilePath,FilePath,Width,Height,Quality,bShellThumbnails,bStretch,bCreate
VFilePath = Request("VFilePath")
If Len(VFilePath)=0 Then VFilePath="NoThumb.gif"
FilePath = Server.MapPath(VFilePath)
If Not fso.FileExists(FilePath) Then
FilePath = Server.MapPath("NoThumb.gif")
End If
If Len(Request("Width"))>0 Then
Width = Int(Request("Width"))
Else Width = 200
End If
If Len(Request("Height"))>0 Then
Height = Int(Request("Height"))
Else Height = 200
End If
If Len(Request("Quality"))>0 Then
Quality = Int(Request("Quality"))
Else Quality = 75
End If
If Len(Request("ShellThumbnails"))>0 Then
bShellThumbnails = (Request("ShellThumbnails")="True")
Else bShellThumbnails = False
End If
If Len(Request("AllowStretch"))>0 Then
bStretch = (Request("AllowStretch")="True")
Else bStretch = False
End If

Dim BinData
If bShellThumbnails Then
' Create COM Shell Thumbnail object
Set objThumb = Server.CreateObject("ThumbExtract.FileThumbExtract")
Call objThumb.SetPath(FilePath)
Call objThumb.SetThumbnailSize(Width,Height)
Call objThumb.ExtractThumbnail
BinData = objThumb.ThumbJpgData(Quality)
Else
' Create COM CxImage wrapper object
Set objCxImage = Server.CreateObject("CxImageATL.CxImage")
Call objCxImage.Load(FilePath,GetFileType(FilePath))
Call objCxImage.IncreaseBpp(24)
' determine thumbnail size and resample original image data
If Not bStretch Then ' retain aspect ratio
widthOrig = CDbl(objCxImage.GetWidth())
heightOrig = CDbl(objCxImage.GetHeight())
fx = widthOrig/Width
fy = heightOrig/Height 'subsample factors
' must fit in thumbnail size
If fx>fy Then f=fx Else f=fy ' Max(fx,fy)
If f<1 Then f=1
widthTh = Int(widthOrig/f)
heightTh = Int(heightOrig/f)
Else
widthTh = Width
heightTh = Height
End If
Call objCxImage.Resample(widthTh,heightTh,2)
BinData = objCxImage.ImageForASP(2,Quality)
End If

' output in Response '
Response.BinaryWrite BinData

Function GetFileType(sFile)
dot = InStrRev(sFile, ".")
filetype=2
If dot > 0 Then sExt = LCase(Mid(sFile, dot + 1, 3))
If sExt = "bmp" Then filetype = 0
If sExt = "gif" Then filetype = 1
If sExt = "jpg" Then filetype = 2
If sExt = "png" Then filetype = 3
If sExt = "ico" Then filetype = 4
If sExt = "tif" Then filetype = 5
If sExt = "tga" Then filetype = 6
If sExt = "pcx" Then filetype = 7
GetFileType=filetype
End Function

%>

¾î¶»°Ô Àû¿ëÇÏ´Â Áö ¾Ë·Á ´Þ¶ó±¸¿ä?
±×¸²º¸´Â htmlű׿¡ ¾Æ·¡¿Í °°ÀÌ ³ÖÀ¸½Ã¸é Àû¿ëµË´Ï´Ù.
¾Æ·¡ ¼Ò½º º¸½Ã¸é ÃæºÐÈ÷ ´Ù¸¥ ¿©·¯°¡Áö ¹æ¹ýÀ¸·Î º¯ÇüÇÏ½Ç ¼ö ÀÖ°ÚÁö¿ä ÈåÈå~~

<!-- #include file ="./ListThumbs.inc" -->
<img src='./ThumbGenerate.asp?VFilePath=/Thumbnail/ThumbAsp/001.gif&
Width=50&Height=50&Quality=75'
border=0 alt='Name: 001.gif'/>

 

ÀλýÀº ª½À´Ï´Ù.
±×·¯¹Ç·Î ´Ù¸¥ »ç¶÷ÀÌ ¿ä±¸ÇÏ´Â »îÀ» »ì¸é¼­ ½Ã°£À» ³¶ºñÇؼ­´Â ¾È µË´Ï´Ù.
µ·°ú ¸í¿¹¸¦ ¾òÁö ¸øÇÏ´õ¶óµµ ³¡±îÁö ÀÚ½ÅÀÇ ±æÀ» °íÁýÇϽʽÿÀ
¸ñ·Ï À­±Û ¾Æ·§±Û
³»¾Ë FREECOUNT.NET ÇÁÄ«³Ý »ý±ä³¯ 2003.12.20 Ȩ | Ä«¿îÅÍ | Ç÷¡½ÃºÏ | ÇÁ¸®º¸µå | Àü±¤ÆÇ | À¥°øºÎ¹æ | Ä¿¹Â´ÏƼ | ÂÊÁöÇÔ