Har denne liggende i dk.edb.internet.webdesign.serverside.asp
Men der sker ikke rigtig noget
Et galleri, og det virker... Finder selv billeder i angivne mappe, men
soterer stiende i alfabetisk, eller nummerisk... men alle billeder ligger i
formatet eks. 2004-02 , 2002-04 og den viser herfor
2002-04 først! -02 og -04 er "billeder i det år" det kunne ligesåvel være
2003-56
Kan der ikke ændres, så den ikke soterer "alfabetisk" eller nærmere
betegnet, falende istedet for stigene...
Håber måske dette hjalp lidt...
Per Ahm
----------------------
<%
ImageDir = "/galleri/" 'This is the directory where the pictures are stored
*CHANGE THIS*
' Remember to put the slash / in the end of these 2 variables
CopyDir = "/galleri/" ' Same directory again. Don't ask Why
*CHANGE
THIS*
picturesperpage = 18 ' *CHANGE THIS TO THE AMOUNT OF PICTURES YOU WANT FOR
EACH PAGE*
' *******************************************************
' Check if we have a subdirectory in the parameter list.
' *******************************************************
subdir = REQUEST("subdir")
IF REQUEST("subdir") <> "" THEN
ImageDir = ImageDir & subdir & "/" ' Add the subdir in parameter to the
current dir.
end if
directpath = server.mappath("/") & ImageDir ' Find the absolute path to the
pictures
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<!-- Minus AutoDato -->
<TITLE>Galleri</TITLE>
<meta name="Generator" content="Microsoft FrontPage 5.0">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<body background="images/page-bg-2.jpg">
<%
' ******************************************************************
' This function is doing the popup window with the original picture
' ******************************************************************
%>
<script type="text/javascript">
function openwindow(photoname, thewidth, theheight) {
thewidth=thewidth+50
theheight=theheight+50
winleft = (screen.width - thewidth) / 2;
i = open("",
"displayWindow","top=10,left="+winleft+",width="+thewidth+",height="+theheig
ht+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes");
i.focus();
i.document.open();
i.document.write('<html>')
i.document.write('<head>')
i.document.write('<title>Camilla & Pers Galleri<\/title>')
i.document.write('<\/head>')
i.document.write('<body>')
i.document.write('<A href="javascript:window.close();">Luk vinduet
igen!<\/A>')
i.document.write('<img src="<%response.write ImageDir%>'+photoname+'"
ALT="">')
i.document.write('<\/body>')
i.document.write('<\/html>')
}
</script>
<style type="text/css">
a.sider {
font-size: 0.9em;
text-decoration: none
}
</style>
</HEAD>
<body link="#000000" vlink="#000000" alink="#000000">
<div>
<p align="center">
<font size="2" face="Verdana">
<%
' ******************************************************************
' This function is checking if AspImage is installed or not.
' ******************************************************************
Function IsComponentInstalled(ProgId)
Dim tmpObject
On Error Resume Next
Set tmpObject = Server.CreateObject(ProgId)
If Err.Number = 0 Then
IsComponentInstalled = True
Else
IsComponentInstalled = False
End If
Set tmpObject = Nothing
End Function
' ******************************************************************
' Get picture, page and id, if they are passed as parameter
' ******************************************************************
picture = request("picture")
id = request("id")
pagenumber = request("page")
If isNumeric(pagenumber) = False Or pagenumber < 1 Then
pagenumber = 1
End If
'*********************************************************************
'* Find all pictures in dictory
'*********************************************************************
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder(Server.MapPath(ImageDir))
Set objFiles = objFolder.Files
numberofpictures = objFiles.Count
strScriptName = Request.Servervariables("ScriptName")
IF numberofpictures > 0 then
intPageCount = -Int(-(numberofpictures/picturesperpage))
ELSE
intPageCount = 1
END IF
IF picture="" then
Response.Write "Der er ialt " & numberofpictures & " billeder i galleriet"
Response.Write " Dette er side " & pagenumber & " af " &
intPageCount & "<BR><BR>"
END IF
'********************************************************************
'* Write "Prev. Page" if currentpage is not page 1
'********************************************************************
If pagenumber > 1 Then
newpage = pagenumber - 1
PgLink = "<a href='" & strScriptName & "?page=" & newpage
IF subdir <> "" then
PgLink = PgLink + "&subdir=" & subdir
END IF
PgLink = PgLink + "' class='sider'><</A> "
Response.Write PgLink
End If
'*********************************************************************
'* Do a link to all single pages
'*********************************************************************
For i = 1 To intPageCount
PgLink = " <a href='" & strScriptName & "?page=" & i
IF subdir <> "" then
PgLink = PgLink + "&subdir=" & subdir
END IF
PgLink = PgLink + "' class='sider'>" & i & "</A>"
Response.Write PgLink
Next
'*********************************************************************
'* Write "Next Page" if currentpage is not the last page
'*********************************************************************
If Cint(pagenumber) < Cint(intPageCount) then
newpage = pagenumber + 1
PgLink = "<a href='" & strScriptName & "?page=" & newpage
IF subdir <> "" then
PgLink = PgLink + "&subdir=" & subdir
END IF
PgLink = PgLink + "' class='sider'> ></A>"
Response.Write PgLink
End If
DIM picturearray
' ******************************************************************
' Run through all files in the directory and put them in the list
' ******************************************************************
For Each Image In objFiles
intFile = intFile + 1
picturelist = picturelist & Image.Name & ","
Next
response.write "<BR>"
picturearray = Split(picturelist,",")
' **************************************************************************
**************
' All places where testing on picture="" then it's because we have to show
the thumbnails
'
****************************************************************************
************
IF picture="" then
'
****************************************************************************
************
' Check if there are any sub-directories in the current folder. If any are
found,
' then show a link for them.
'
' First, if we already are in a subfolder, the do a link for the prev.
folder-
' I'm doing a lot "not easy to read" string manipulation here. I don't want
to use space
' to explain what i actually do in here.
'
****************************************************************************
************
IF subdir <> "" THEN
chkstr = "/"
manipstr = left(ImageDir, Len(ImageDir)-1)
NewDir=left(manipstr,InStrRev(manipstr, chkstr))
IF NewDir = CopyDir then ' This is because the prev. dir is the root.
response.write " <A href='foto.asp'><IMG src='prdir.gif'
alt='Root directory'></A> "
ELSE
NewDir = Mid(NewDir, Len(CopyDir)+1, Len(NewDir)-Len(CopyDir)-1)
Response.write " <A href='foto.asp?subdir="&NewDir&"'><IMG
src='prdir.gif' alt='"&NewDir&"'></A> "
END IF
END IF
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(directpath)
Set subFolders = folder.SubFolders
For Each folderObject in SubFolders
if subdir <> "" then
thesubfolder = subdir & "/" & folderObject.Name
else
thesubfolder = folderObject.Name
end if
Response.Write " <A href='foto.asp?subdir="&thesubfolder&"'><IMG
src='dir.gif' alt='"&folderObject.Name & "'></A> "
Next
Set subFolders = Nothing
Set folder = Nothing
Set fso = Nothing
response.write "<BR>"
FOR countit=0 TO intFile-1
If (countit >= (pagenumber-1)*picturesperpage) And (countit <
(picturesperpage*pagenumber)) Then
If IsComponentInstalled("AspImage.Image") Then
PicLink = "<A
href='"&strScriptName&"?picture="&picturearray(countit)&"&id="&countit
IF subdir <> "" then
PicLink = PicLink + "&subdir=" & subdir
END IF
PicLink = PicLink + "'><IMG SRC='crttmb.asp?path="&directpath &
"&File="&picturearray(countit)&"' alt='Klik for at se stort
billede.'></A> "
response.write PicLink
else
PicLink = "<A
href='foto.asp?picture="&picturearray(countit)&"&id="&countit
IF subdir <> "" then
PicLink = PicLink + "&subdir=" & subdir
END IF
PicLink = PicLink + "'><IMG SRC='"&ImageDir&picturearray(countit)&"'
width='100' height='100' alt='Klik for at se stort billede.'></A> "
response.write PicLink
end if
end if
next
END IF
'
****************************************************************************
************
' Setup variables for next and previous pictures. Test if current picture is
the first or
'
****************************************************************************
************ last
IF picture<>"" then
if cint(id)=0 then
prev=numberofpictures-1
else
prev=id-1
end if
if cint(id)=cint(numberofpictures-1) then
nextone=0
else
nextone=id+1
end if
' ********************************************
' Write the link to the previous picture
' ********************************************
PicLink = "<br><br><A
href='"&strScriptName&"?picture="&picturearray(prev)&"&id="&prev
IF subdir <> "" then
PicLink = PicLink + "&subdir=" & subdir
END IF
PicLink = PicLink + "'>Sidste Billede</A> "
response.write PicLink
' ********************************************
' Write the link to the next picture
' ********************************************
PicLink = "<A
href='"&strScriptName&"?picture="&picturearray(nextone)&"&id="&nextone
IF subdir <> "" then
PicLink = PicLink + "&subdir=" & subdir
END IF
PicLink = PicLink + "'>Næste billede</A> "
response.write PicLink
If IsComponentInstalled("AspImage.Image") Then
' Set AspImage object to load width and height of the picture (used with the
popup)
Set Image = Server.CreateObject("AspImage.Image")
Image.LoadImage directpath & picture
thewidth= Image.MaxX
theheight = Image.MaxY
Set objImg = Nothing
else
thewidth = 600
theheight = 400
end if
vaerd = """javascript
enwindow('"&picture&"',"&thewidth& ","&theheight
&")"""
response.write "<BR><BR><A href="&vaerd&"><IMG src=""" & ImageDir & picture
& """ width=""70%"" alt=""Klik for at åbne i original størelse.""></A>"
end if
Set objFS = Nothing
%> </font>
</DIV>
</BODY>
</HTML>