Asp billedarkiv
Jeg har lavet følgende, med noget kode jeg har fået...<%
dim strfilearr, strcountfiles, randomfile, directory, allfiles, directoryfile
strmappe = "grafik"
Set directory=server.createobject("scripting.filesystemobject")
Set allfiles=directory.getfolder(server.mappath(strmappe))
For each directoryfile in allfiles.files
strfilearr = strfilearr + directoryfile.Name & ","
strcountfiles = strcountfiles + 1
Next
if request.querystring("execute") ="popup" then
ImageArray = split(strfilearr,",")
response.write "<html>" & vbCrLf &_
"<head>" & vbCrLf &_
"<title>GAC image gallery</title>" & vbCrLf &_
"<script>" & vbCrLf &_
"function resizeMe(){" & vbCrLf &_
"if (navigator.appName == 'Netscape'){" & vbCrLf &_
"adjWidth = document.images[""0""].width + 6;" & vbCrLf &_
"adjHeight = document.images[""0""].height + 27;" & vbCrLf &_
"}" & vbCrLf &_
"else {" & vbCrLf &_
"adjWidth = document.images[""0""].width + 100;" & vbCrLf &_
"adjHeight = document.images[""0""].height + 150;" & vbCrLf &_
"}" & vbCrLf &_
"window.resizeTo(adjWidth, adjHeight);" & vbCrLf &_
"window.focus()" & vbCrLf &_
"}" & vbCrLf &_
"</script>" & vbCrLf &_
"</head>" & vbCrLf &_
"<body margin='0' onLoad=""resizeMe();"">" & vbCrLf &_
"<table style='width:100%;height:100%;'>" & vbCrLf &_
"<tr>" & vbCrLf &_
"<td style='width:100%;height:100%;vertical-align:middle;text-align:center;'>" & vbCrLf &_
"<img src='"&strmappe&"/"&ImageArray(request.querystring("id")-1)&"' name=""0"" id='0' border='0'>" & vbCrLf &_
"</td>" & vbCrLf &_
"</tr>" & vbCrLf &_
"<tr>" & vbCrLf &_
"<td style='text-align:center;'><a href='java script:window.close();'>close</a></td>" & vbCrLf &_
"</tr>" & vbCrLf &_
"</table>" & vbCrLf &_
"</body>" & vbCrLf &_
"</html>" & vbCrLf
else
response.write "<html>" & vbCrLf &_
"<head>" & vbCrLf &_
"<title>GAC image gallery</title>" & vbCrLf &_
"<SCRIPT LANGUAGE=""Javascript"" type=""text/javascript"">" & vbCrLf &_
"<!--" & vbCrLf &_
"function Popit(url) {" & vbCrLf &_
" popupWin = window.open(url,'new_page','width=500,height=400,scrollbars=yes')" & vbCrLf &_
"}" & vbCrLf &_
"//-->" & vbCrLf &_
"</SCRIPT>" & vbCrLf &_
"</head>" & vbCrLf &_
"<body style='text-align:center; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #990000'>" & vbCrLf
Dim CurrentPage, CountPages, ItemsprPage, ItemsTotal, ImageArray, StartImg, EndImg, SiteName, CountImgPrint
SiteName = request.servervariables("script_name")
ItemsTotal = strcountfiles
ItemsprPage = "2000"
CurrentPage = request.querystring("id")
If CurrentPage = "" or CurrentPage = "0" then CurrentPage = "1"
CountPages = (ItemsTotal/ItemsprPage)
if CountPages > int(CountPages) then CountPages = int(CountPages) + 1
ImageArray = split(strfilearr,",")
StartImg = ((CurrentPage-1)*(ItemsprPage))
If StartImg = "0" then StartImg = "1"
EndImg = (ItemsTotal-StartImg)
if cint(EndImg) > cint(ItemsprPage) then
EndImg = round(StartImg-1) + round(ItemsprPage)
else
EndImg = (StartImg + EndImg)
End if
response.write "<table style='width:50%;'>"
CountImgPrint = 0
For I = StartImg to EndImg
CountImgPrint = CountImgPrint +1
If CountImgPrint = 1 then response.write "<tr>" & vbCrLf & vbCrLf
response.write "<td style='width:20%; text-align:left; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #990000'><a href=""java script: Popit('"&SiteName&"?execute=popup&id="&I&"')"" onfocus='blur()'><img src='"&strmappe&"/"&ImageArray(I-1)&"' border='0' style='width:60px;;height:60px;' /></a><br><img src='pics/butpil.gif'>Add to CD<input type='checkbox' name='checkbox' value='checkbox'><br><img src='pics/butpil.gif'><a href=""java script: Popit('"&SiteName&"?execute=popup&id="&I&"')"" style='color: #990000; text-decoration: none' onfocus='blur()'>See Large image</a></td>" & vbCrLf
If CountImgPrint = 4 then
response.write "</tr>" & vbCrLf & vbCrLf
CountImgPrint = 0
end if
Next
response.write "</tr>" & vbCrLf &_
"<tr>" & vbCrLf &_
"<td colspan='5' style='width:100%;text-align:center;'>" & vbCrLf
response.write "</td>" & vbCrLf &_
"</tr>" & vbCrLf &_
"</table>" & vbCrLf &_
"</body>" & vbCrLf &_
"</html>" & vbCrLf
end if
%>
Jeg har lavet lidt om på koden, men der er noget jeg har svært ved.
Hvordan viser jeg også filstørelsen?
Kan thumbnailsne laves i det rigtige format, så de ikke bliver forrænget?
Kan man også vise filnavnet uden extension?
...og hvordan gøres det!!!
Der er 40 bananer for hvert af de 3 spørgsmål