Thumbnails til galleri
Hej.Jeg har en ASP kode, som automatisk finder mapper samt billeder på min hjemmeside, og skriver dem ud. Men når nogle af mapperne indeholder over 10MB billeder tager det jo lang tid at hente alle billederne.
Det som jeg gerne vil have hjælp til, er at få gennereret nogle thumbnails automatisk ved hjælp af fx ASPImage (Som mit webhotel udbyder). Har søgt her på eksperten, men syntes ikke at jeg kan finde noget jeg kan bruge. Håber at der er nogen der kan hjælpe mig.
Koden er her:
<%
folder = request.querystring("folder")
folderspec = server.mappath("images/"&folder&"")
if folder <> "" then
sfolder = ""&folder&"/"
end if
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofolder = filesys.GetFolder(folderspec)
Set folcoll = demofolder.SubFolders
For Each subfol in folcoll
folsize = left((subfol.size/1000000), 3)
folist = folist & " <a href='?folder="&sfolder&"" & subfol.name & "'><strong title='view'>»</strong> " & subfol.Name & " </a><small> (" & folsize & " MB)</small>" & vbcrlf
folist = folist & " <br><br>"
Next
set filesys = nothing
Response.Write folist
filepath = server.mappath("images/"&folder&"")
captionfile = filepath & "\captions.txt"
Set filesys = CreateObject("Scripting.FileSystemObject")
Dim SomeArray()
'caption part
If filesys.FileExists(captionfile) then
set file = filesys.GetFile(captionfile)
Set TextStream = file.OpenAsTextStream(ForReading,TristateUseDefault)
captioncount = 0
Do While Not TextStream.AtEndOfStream
Line = TextStream.readline
ReDim Preserve SomeArray(captioncount)
SomeArray(captioncount) = line
'response.write captioncount & " " & somearray(captioncount) & "<br>"
captioncount = captioncount + 1
'Response.write Line
Loop
textStream.close
end if
'folder part
Set demofolder = filesys.GetFolder(filepath)
Set filecoll = demofolder.Files
filecount = 0
For Each file in filecoll
Ext = UCase(Right(File.Path, 3))
If Ext = "JPG" OR Ext = "GIF" OR Ext = "PNG" Then
on error resume next
data = SomeArray(filecount)
on error goto 0
hrefpath = "images/" & folder & "/" & file.name
imagepath = "<div style='float:left;padding: 2px; width: 82px;'>" & data & "<a href='" & hrefpath & "' border=0><img src='" & hrefpath & "' height=""60"" border='" & border_size & "' title=""" & data & """ style='border-color: " & border_color & ";'></a>"
filist = filist & imagepath
filist = filist & "</div>"
filecount = filecount + 1
data = ""
end if
Next
set filesys = Nothing
%>
<p><%=filist%></p>