Foto album og thumbnails
Hejsa...Jeg kunne godt tænke mig at få lavet lidt thumbnails.. Men er helt på bar bund..
Det jeg tænker er jeg vil have et billede der hedder fx billede_lille.jpg som er det den viser på siden. og når jeg trykker på billedet åbner den så billede.jpg
Bruger denne her script til at vise alle billederne i en mappe:
<%
' Hvis brugeren ikke er logget rigtigt på
' sendes han/hun direkte til formularen
If Session("login") <> "JA" Then
Response.Redirect "../index.html"
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
'Copy this file into a directory with folders containing images (jpg, gif).
'(optional) create a text file called captions.txt in each folder.
' with a caption on each line to go with each picture (in alphabetical order).
' set border size to a value greater than zero if you want a border around the picture.
' set border color if you have set a border size greater than 0.
' set the text-align: within the <style> tag to be left/center/right.
' set the font-family: within the <style> tag to be the font of your choice.
border_size = "7"
border_color = "silver"
%>
<html>
<head>
<title>foto</title>
<link rel="stylesheet" type="text/css" href="../style/style.css">
</head>
<a name="top"></a>
<h2>foto</h2>
<body>
<%
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
qfolder = request.querystring("f")
if qfolder = "" then
folderspec = server.mappath(".")
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='?f=" & subfol.name & "'><strong title='view'>»</strong> " & subfol.Name & " </a><small> (" & folsize & " MB)</small>" & vbcrlf
folist = folist & "<BR>"
Next
set filesys = nothing
Response.Write folist
else
filepath = server.mappath(".") & "\" & qfolder
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" Then
on error resume next
data = SomeArray(filecount)
on error goto 0
hrefpath = qfolder & "/" & file.name
imagepath = "<strong>" & data & "</strong><a href='" & hrefpath &"' title='Se billedet i stort' border=0 target=""_new""><img src='" & hrefpath & " ' Width='320' Height='240'border=1'" & border_size & "' title=""" & data & """ style='border-color: " & border_color & ";'></a>"
filist = filist & imagepath & vbcrlf
filecount = filecount + 1
data = ""
end if
Next
set filesys = Nothing
filist = filist
%>
</p>
<p align="center">
<small><a href="." >Tilbage</a></p></small>
<p align="center" ><%=filist%></p>
<p align="center" >
<small><a href="." >Tilbage</a></p></small>
<% end if %>
</p>
</body>
</html>