Avatar billede domaz Nybegynder
26. august 2002 - 20:11 Der er 4 kommentarer og
1 løsning

Foto-Album Script

Hej Eksperter.

Jeg har fundet et færdigt lavet FotoAlbum script i ASP..
Jeg har ændret lidt i det, for at få sort baggrund og hvid tekst osv.
Men nu virker det ikke..

Orginal koden :

<html><head>
<title>ASP Picture Album by Jan Borup Coyle</title>
<script language="JavaScript">
<!--
function jumppage(sel)
{
  var i = sel.selectedIndex
  self.location.href = sel.options[i].value
}
// -->
</script>
</head><body>

<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="800" id="AutoNumber1">
<tr>
<td align="center" width="75%">
</td>
<td align="center" width="25%">
  <form action=<%=CurFile%> method="POST">
  <h3>Select Album :
  <select name="go" onChange="jumppage(this);" size=1>
  <%
  ShowSub = request("ShowSub")
  ShowPic = request("ShowPic")
  strPathInfo = Request.ServerVariables("PATH_INFO")
  strPhysicalPath = Server.MapPath(strPathInfo)

  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFile = objFSO.GetFile(strPhysicalPath)
  Set objFolder = objFile.ParentFolder
  Set objFolderContents = objFolder.Files
  For each Folder in objFolder.SubFolders
      If Left(Folder.Name,1)<>"_" Then
          Response.write "<option "
          If ShowSub=Folder.Name Then
              Response.Write "selected "
          End if
          Response.Write"value='" & CurFile & "?ShowSub="
          Response.Write(Replace(Folder.Name, " ", "%20"))
          response.write "'>"
          Response.Write(Folder.Name & "</option>")
          If ShowSub <= " " Then
            ShowSub = Folder.Name
        End if
      End if
  Next
  Set objFSO = Nothing
  %>
  </select></h3>
  </form>
  </td>
</tr>
</table>
<hr>

<%
If ShowPic > " " then
  ShowPic = Replace(ShowPic, " ", "%20")
  Response.Write "<a href='java script:history.go(-1)'><img src='" & ShowPic & "'><BR><BR><B>Go Back</B></a>"
Else
%>
  <table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse" bordercolor="#111111" width="800" id="AutoNumber1">
  <tr>
  <%
  strPhysicalPath = Server.MapPath(".\" & ShowSub)
  If ShowSub > " " then
    ShowSub = Replace(ShowSub, " ", "%20")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder(strPhysicalPath)
    Set objFolderContents = objFolder.Files
    For Each objFileItem in objFolderContents
    If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN
        ShowPic = Replace(objFileItem.Name, " ", "%20")
      'Response.write "<td align='center' width='25%'><a href=" & ShowSub & "\"
      Response.write "<td align='center' width='25%'><a href=" & CurFile & "?ShowPic=" & ShowSub  & "\" & ShowPic
      'Response.Write(Replace(objFileItem.Name, " ", "%20"))
      Response.write ">"
      Response.Write("<img src='" & ShowSub & "\" & objFileItem.Name & "' width=200> ")
      Response.Write("<p align='center'><b>" & Mid(objFileItem.Name,1,Len(objFileItem.Name)-4) & "</b>")
      Response.write "</a></td>"
      PictureNo = PictureNo + 1
      If PictureNo=4 Then
          Response.write "</tr><tr>"
          PictureNo = 0
      End if
    End if
    Next
    Set objFSO = Nothing
  End if
  %>
  </tr>
  </table>
<%
End if
%>
</center>
</html>



Redigeret af mig :
<%
' ASP Picture Album made by Jan Borup Coyle, mailto:jb@xess.dk for Comments

Dim CurFile, ShowSub, ShowPic, PictureNo
Dim strPathInfo, strPhysicalPath

CurFile = "ShowPicture.asp"
%>

<html><head>
<title>ASP Picture Album by Jan Borup Coyle</title>
<script language="JavaScript">
<!--
function jumppage(sel)
{
  var i = sel.selectedIndex
  self.location.href = sel.options[i].value
}
// -->
</script>
</head><body bgcolor="#000000">

<center>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">'<font size="5" color="#FFFFFF">Blandet
Billeder.</font></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" color="#FFFFFF">Taget med Webcam - så de er nok ikke så fandens
klare, men håber i overlever ;)</font></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" color="#FFFFFF">Billederne står nok rimeligt rodet , men det er
et færdig-lavet script jeg har hentet og bruger.</font></p>
<hr>

<%
If ShowPic > " " then
  ShowPic = Replace(ShowPic, " ", "%20")
  Response.Write "<a href='java script:history.go(-1)'><img src='" & ShowPic & "'><BR><BR><B>Go Back</B></a>"
Else
%>
  <table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse" bordercolor="#111111" width="800" id="AutoNumber1">
  <tr>
  <%
  strPhysicalPath = Server.MapPath(".\" & ShowSub)
  If ShowSub > " " then
    ShowSub = Replace(ShowSub, " ", "%20")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder(strPhysicalPath)
    Set objFolderContents = objFolder.Files
    For Each objFileItem in objFolderContents
    If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN
        ShowPic = Replace(objFileItem.Name, " ", "%20")
      'Response.write "<td align='center' width='25%'><a href=" & ShowSub & "\"
      Response.write "<td align='center' width='25%'><a href=" & CurFile & "?ShowPic=" & ShowSub  & "\" & ShowPic
      'Response.Write(Replace(objFileItem.Name, " ", "%20"))
      Response.write ">"
      Response.Write("<img src='" & ShowSub & "\" & objFileItem.Name & "' width=200> ")
      Response.Write("<p align='center'><b>" & Mid(objFileItem.Name,1,Len(objFileItem.Name)-4) & "</b>")
      Response.write "</a></td>"
      PictureNo = PictureNo + 1
      If PictureNo=4 Then
          Response.write "</tr><tr>"
          PictureNo = 0
      End if
    End if
    Next
    Set objFSO = Nothing
  End if
  %>
  </tr>
  </table>
<%
End if
%>
</center>
</html>

<---
Jeg er mega newbie til ASP, og fatter keine af programmering generalt..så ville blive glad hvis der var en som ville rette fejlen og pooste hele koden ;)
Avatar billede eagleeye Praktikant
26. august 2002 - 20:28 #1
Så vidt jeg kan se har du også fjernet den dropdown box hvor man vælger Album..
Avatar billede eagleeye Praktikant
26. august 2002 - 20:36 #2
Det jeg prøvet at sige/spørge om er skal du bare rette et par farveer eller skal koden laves om til et bestemt formål ???
Avatar billede domaz Nybegynder
26. august 2002 - 21:27 #3
Nej, jeg kla bare have lavet farven om..
Baggrunden sort, og hvid text, og så skal der bare stå den der overskrift som der står nu ...

Det er det eneste ..
Avatar billede eagleeye Praktikant
26. august 2002 - 21:32 #4
Prøv denne:


<html><head>
<title>ASP Picture Album by Jan Borup Coyle</title>
<script language="JavaScript">
<!--
function jumppage(sel)
{
  var i = sel.selectedIndex
  self.location.href = sel.options[i].value
}
// -->
</script>
</head><body bgcolor="#000000" text=Black>

<center>

<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">'<font size="5" color="#FFFFFF">Blandet
Billeder.</font></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" color="#FFFFFF">Taget med Webcam - så de er nok ikke så fandens
klare, men håber i overlever ;)</font></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="2" color="#FFFFFF">Billederne står nok rimeligt rodet , men det er
et færdig-lavet script jeg har hentet og bruger.</font></p>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="800" id="AutoNumber1">
<tr>
<td align="center" width="75%">
</td>
<td align="center" width="25%">
  <form action=<%=CurFile%> method="POST">
  <h3>Select Album :
  <select name="go" onChange="jumppage(this);" size=1>
  <%
  ShowSub = request("ShowSub")
  ShowPic = request("ShowPic")
  strPathInfo = Request.ServerVariables("PATH_INFO")
  strPhysicalPath = Server.MapPath(strPathInfo)

  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFile = objFSO.GetFile(strPhysicalPath)
  Set objFolder = objFile.ParentFolder
  Set objFolderContents = objFolder.Files
  For each Folder in objFolder.SubFolders
      If Left(Folder.Name,1)<>"_" Then
          Response.write "<option "
          If ShowSub=Folder.Name Then
              Response.Write "selected "
          End if
          Response.Write"value='" & CurFile & "?ShowSub="
          Response.Write(Replace(Folder.Name, " ", "%20"))
          response.write "'>"
          Response.Write(Folder.Name & "</option>")
          If ShowSub <= " " Then
            ShowSub = Folder.Name
        End if
      End if
  Next
  Set objFSO = Nothing
  %>
  </select></h3>
  </form>
  </td>
</tr>
</table>
<hr>

<%
If ShowPic > " " then
  ShowPic = Replace(ShowPic, " ", "%20")
  Response.Write "<a href='java script:history.go(-1)'><img src='" & ShowPic & "'><BR><BR><B>Go Back</B></a>"
Else
%>
  <table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse" bordercolor="#111111" width="800" id="AutoNumber1">
  <tr>
  <%
  strPhysicalPath = Server.MapPath(".\" & ShowSub)
  If ShowSub > " " then
    ShowSub = Replace(ShowSub, " ", "%20")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder(strPhysicalPath)
    Set objFolderContents = objFolder.Files
    For Each objFileItem in objFolderContents
    If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN
        ShowPic = Replace(objFileItem.Name, " ", "%20")
      'Response.write "<td align='center' width='25%'><a href=" & ShowSub & "\"
      Response.write "<td align='center' width='25%'><a href=" & CurFile & "?ShowPic=" & ShowSub  & "\" & ShowPic
      'Response.Write(Replace(objFileItem.Name, " ", "%20"))
      Response.write ">"
      Response.Write("<img src='" & ShowSub & "\" & objFileItem.Name & "' width=200> ")
      Response.Write("<p align='center'><b>" & Mid(objFileItem.Name,1,Len(objFileItem.Name)-4) & "</b>")
      Response.write "</a></td>"
      PictureNo = PictureNo + 1
      If PictureNo=4 Then
          Response.write "</tr><tr>"
          PictureNo = 0
      End if
    End if
    Next
    Set objFSO = Nothing
  End if
  %>
  </tr>
  </table>
<%
End if
%>
</center>
</html>
Avatar billede domaz Nybegynder
27. august 2002 - 17:34 #5
'Det virker ;)
Taaak for det..
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester