problemmer med fotoalbum
Jeg bruger dette fotoalbum til at få vist nogle billeder på min hjemmeside! Men jeg kan ikke få den til at vise thumbnails. Den viser bare tomme rammer, men billederne kommer når man klikker på dem! ( www.csst.dk/pic/foto.asp )Koden for filerne er:
Foto.asp:
<%
' This is BBC Webgallery V2.0. Webgallery is freeware for private usage.
' For commercial use, please contact me on webmaster@patricia-brinch.dk
'
' To use this script, it's recommended to have the AspImage component installed on the server.
' But no matter what, the script will work, because it will check if AspImage is installed or
' not. If not then thumbnails are just created, using width/height on the IMG tag.
'
' To use this script on your own server, you have to change a few statements. All statements
' that have to be changed, is marked with *CHANGE THIS* So just search for this in the
' script and you will easily find what you need.
'
' If you like this script, feel free to use it at no costs. One thing i would like, is a
' note in the guestbook on http://www.patricia-brinch.dk
'
' I can not give any support on this script (you know, it's freeware, bla. bla.) But however
' you can try to ask in any ASP forums. The script is pretty easy and self documentated.
'
' Good luck with the script and if you need to see any examples where the script is used,
' take a look at http://www.patricia-brinch.dk/dk/foto.asp or a raw-script with no extra on
' http://www.patricia-brinch.dk/webgalleryv2/foto.asp
'
'
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<!-- Minus AutoDato -->
<TITLE>BBC Webgallery V2.0</TITLE>
<META NAME="Generator" CONTENT="Microsoft FrontPage 5.0">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%
'
' 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="+theheight+",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>BBC Webgallery V2.0<\/title>')
i.document.write('<\/head>')
i.document.write('<body>')
i.document.write('<A href="java script:window.close();">Close Window<\/A>')
i.document.write('<img src="../../gfx/foto/'+photoname+'" ALT="">')
i.document.write('<\/body>')
i.document.write('<\/html>')
}
</script>
<style type="text/css">
a.sider {
font-size: 0.7em;
}
</style>
</HEAD>
<body>
<div>
<%
' This function is checking if AspImage is installed or not.
' Call the function like this: If IsComponentInstalled("AspImage.Image") Then......
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
ImageDir = "../foto/pic/" 'This is the directory where the pictures are stored *CHANGE THIS*
directpath = "http://www.csst.dk/foto/pic/" ' Direct path to the pics *CHANGE THIS*
picturesperpage = 40 ' *CHANGE THIS*
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")
intPageCount = -Int(-(numberofpictures/picturesperpage))
IF picture="" then
Response.Write "Total of " & numberofpictures & " pictures in this webgallery"
Response.Write " This is page " & pagenumber & " of " & intPageCount & "<BR><BR>"
END IF
'********************************************************************
'* Write "Prev. Page" if currentpage is not page 1
'********************************************************************
If pagenumber > 1 Then
newpage = pagenumber - 1
Response.Write "<a href='" & strScriptName & "?page=" & newpage & "' class=""sider"">[Prev. page] </A>"
End If
'*********************************************************************
'* Do a link to all single pages
'*********************************************************************
For i = 1 To intPageCount
Response.Write " <a href='" & strScriptName & "?page=" & i & "' class=""sider"">" & i & " </a>"
Next
'*********************************************************************
'* Write "Next Page" if currentpage is not the last page
'*********************************************************************
If Cint(pagenumber) < Cint(intPageCount) then
newpage = pagenumber + 1
Response.Write "<a href='" & strScriptName & "?page=" & newpage & "' class=""sider"">[Next page]</A>"
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
picturearray = Split(picturelist,",")
' All places where testing on picture="" then it's because we have to show the thumbnails
IF picture="" then
response.write "<BR>"
FOR countit=0 TO intFile-1
If (countit >= (pagenumber-1)*picturesperpage) And (countit < (picturesperpage*pagenumber)) Then
If IsComponentInstalled("AspImage.Image") Then
response.write "<A href="""&strScriptName&"?picture="&picturearray(countit)&"&id="&countit&"""><IMG SRC=""crttmb.asp?Path=" & directpath & "&File=" & picturearray(countit) & """ alt=""Click here to view large picture.""></A> "
else
response.write "<A href="""&strScriptName&"?picture="&picturearray(countit)&"&id="&countit&"""><IMG SRC="""&ImgDir&picture&""" width=""50"" height=""50"" alt=""Click here to view large picture.""></A> "
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
response.write "<BR><BR><A href="""&strScriptName&"?picture="&picturearray(prev)&"&id="&prev&""">Prev. Picture</A> "
' Write the link to the next picture
response.write "<A href="""&strScriptName&"?picture="&picturearray(nextone)&"&id="&nextone&""">Next Picture</A> "
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 = 800
theheight = 600
end if
vaerd = """java script:openwindow('"&picture&"',"&thewidth& ","&theheight &")"""
response.write "<BR><BR><A href="&vaerd&"><IMG src=""" & ImageDir & picture & """ width=""70%"" alt=""Click to open popup windows with original size picture.""></A>"
end if
Set objFS = Nothing
%>
</DIV>
</BODY>
</HTML>
og crttmb.asb:
<%
' This script is doing the thumbnail on the fly, using AspImage.
' If you don't have AspImage installed, then don't worry. The script will
' find out and do the thumb in anotherway.
Dim strFuldeSti, strFilNavn, intSize, intQuality
strFuldeSti = Request("Path")
strFilNavn = Request("File")
intSize = 75 ' This is the width and height of the thumbnails
intQuality = 90
If strFuldeSti = "" OR strFilNavn = "" Then
Response.write "FEJL"
Else
Set MyImage = Server.CreateObject("AspImage.Image")
Dim strOriginal, strThumb, ResizedX,ResizedY
strOriginal = strFuldeSti & strFilNavn
MyImage.LoadImage strOriginal
MyImage.Resize intSize,intSize
MyImage.ImageFormat = 1
MyImage.JPEGQuality = intQuality
ProgressiveJPEGEncoding = true
Response.BinaryWrite MyImage.Image
Set MyImage = Nothing
End If
%>
