Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12
  1. #1

    PROBLEMA ESTRAZIONE IMMAGINI DA CARTELLE

    ciao ragazzi
    avrei bisogno di un aiutino.
    ho scaricato questi 2 file (PhotoAlbum.asp e ShowPicture.asp) che servono per visualizzare delle immagini presenti in alcune cartelle.
    Di default il file photoalbum.asp (codice allegato di seguito) visualizza i nomi delle cartelle presenti ove risiede il file e selezionando la cartella ne visualizza le immagini presenti.
    E' possibile, modificando qualcosa, che questo file possa visualizzare le cartelle presenti in un altra cartella della root e non nella cartella dove si trova il file?
    grazie in anticipo a tutti
    ciao
    Mara



    --------------------------------------------
    <%


    Dim CurFile, PopFileShowSub, ShowPic, PictureNo
    Dim strPathInfo, strPhysicalPath


    Dim intTotPics, intPicsPerRow, intPicsPerPage, intTotPages, intPage, strPicArray()
    intPicsPerRow = 3
    intPicsPerPage = 6

    intPage = CInt(Request.QueryString("Page"))
    If intPage = 0 Then
    intPage = 1
    End If


    CurFile = "PhotoAlbum.asp"
    PopFile = "ShowPicture.asp"
    %>
    <link rel="stylesheet" type="text/css" href="style.css">
    <script language="JavaScript">
    <!--
    function jumppage(sel)
    {
    var i = sel.selectedIndex
    self.location.href = sel.options[i].value
    }
    // -->
    </script>
    <script language="JavaScript">
    <!-- hide from JavaScript-challenged browsers
    function openGalleryWindow(url) {
    if (document.all)
    var xMax = screen.width, yMax = screen.height;
    else
    if (document.layers)
    var xMax = window.outerWidth, yMax = window.outerHeight;
    else
    var xMax = 800, yMax=600;
    var xOffset = (xMax - 200)/2, yOffset = (yMax - 200)/2;
    var xOffset = 100, yOffset = 100;

    popupWin = window.open(url,'new_page','width=700,height=535,s creenX='+xOffset+',screenY='+yOffset+',top='+yOffs et+',left='+xOffset+',scrollbars=auto,toolbars=no, menubar=no,resizable=yes')
    }
    // done hiding -->
    </script>

    <style type="text/css">
    <!--
    a:link {
    color: #000000;
    text-decoration: none;
    }
    a:visited {
    color: #000000;
    text-decoration: none;
    }
    a:hover {
    color: #000000;
    text-decoration: underline;
    }
    a:active {
    color: #000000;
    text-decoration: none;
    }
    body,td,th {
    font-size: 10px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    }
    a {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: xx-small;
    }
    .Stile4 {color: #000000; font-style: italic;}
    -->
    </style><center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#000000" width="400" id="AutoNumber1">
    <tr>

    <td align="center" width="25%">
    <form action=<%=PopFile%> method="POST">
    <font face="<%= strDefaultFontFace %>" size="<% =strFooterFontSize %>" color="<% =strBaseFontColor %>">Photo 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>


    <span class="Stile4">
    <%
    If ShowPic > " " then
    ShowPic = Replace(ShowPic, " ", "%20")
    Response.Write "<a href='JavaScript:history.go(-1)'>[img]" & ShowPic & "[/img]

    <font face=""verdana"" size=""1"">Go Back</a>"
    Else
    %>
    </span>
    <table border="0" cellpadding="5" cellspacing="5" style="border-collapse: collapse" width="400" 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



    'Get the number of pictures in the subdirectory
    intTotPics = 0
    For Each objFileItem in objFolderContents
    If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN
    intTotPics = intTotPics + 1
    End if
    Next

    'Get the total number of pages in the subdirectory
    If (intTotPics/intPicsPerPage) = (int(intTotPics/intPicsPerPage)) Then
    intTotPages = int(intTotPics/intPicsPerPage)
    Else
    intTotPages = int(intTotPics/intPicsPerPage)+1
    End If
    Redim strPicArray(2,intTotPics)

    'Store picture file names in an array
    x = 0
    For Each objFileItem in objFolderContents
    If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN
    strPicArray(0,x) = objFileItem.Name
    strPicArray(1,x) = Cstr(int(x/intPicsPerPage)+1)
    x = x + 1
    End if
    Next

    'Determine if there are multiple pages and if so, display page numbers.
    If intTotPages > 1 Then
    Response.Write "<td colspan='" & intPicsPerRow & "' align='center'><font face='Verdana,Arial' size='2'>Pagina:"
    For x = 1 to intTotPages
    If x = intPage Then
    Response.Write "</font><font face='Arial' size='2'>" & x & "</font><font face='Arial' size='2'>"
    Else
    Response.Write "" & x & ""
    End If
    Next
    Response.Write "</font></td>"
    Response.Write "</tr><tr><td></td></tr><tr>"
    End If


    For x = 0 to UBound(strPicArray,2)-1
    If CInt(strPicArray(1,x)) = intPage Then
    ShowPic = Replace(strPicArray(0,x), " ", "%20")
    Response.write "<td align='center' width='25%'><a href=""JavascriptpenGalleryWindow('" & PopFile & "?ShowPic=" & ShowSub & "/" & ShowPic & "')"""
    Response.write "
    "
    Response.Write("[img]" & ShowSub & "/" & strPicArray(0,x) & "[/img] ")
    Response.Write("
    <font color=""" & strBaseFontColor & """>" & Mid(strPicArray(0,x),1,Len(strPicArray(0,x))-4) & "</font>")
    Response.write "</a></td>" & vbcrlf

    PictureNo = PictureNo + 1
    If PictureNo=intPicsPerRow Then
    Response.write "</tr><tr>"
    PictureNo = 0
    End if
    End If
    Next



    Set objFSO = Nothing
    End if
    %>
    </tr>
    </table>
    <%
    End if
    %>

    </center>
    </html>

    -----------------------------------------------

  2. #2
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    sostituirea
    codice:
     strPhysicalPath = Server.MapPath(strPathInfo)
    questo

    codice:
     strPhysicalPath = Server.MapPath("/percorso relativo della dir da visualizzare")
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  3. #3
    Ciao kalosjo
    grazie per la risposta.
    ho provato a dinserire il persorso in tutti i modi
    tipo /immagini immagini/ ../immagini
    ma nulla
    mi da tutto bianco come se non trovasse nulla

    Mara

  4. #4
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    La cartella immagini è nella root?
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  5. #5
    si nella root

  6. #6
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    Prova anche questa modifica:
    codice:
     Set objFolder = objFile.ParentFolder
    con
    codice:
     Set objFolder = objFile.Folder
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  7. #7
    nulla
    sempre uguale
    ma come mai? mannaggia...

  8. #8
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    Scusa, ti ho fatto fare delle modifiche del cavolo!!!!
    Dovresti procedere così:

    codice:
     
    strPhysicalPath = Server.MapPath("/percorso relativo della dir da visualizzare")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'Set objFile = objFSO.GetFile(strPhysicalPath)
    'Set objFolder = objFile.ParentFolder 
    Set objFolder = objFSO.GetFolder(strPhysicalPath)
    Commenta le righe che ho indicato commentate
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  9. #9
    ci siamo quasi
    nel riquadro ora vedo le cartelle giuste
    ma sotto mi indica questo:

    Microsoft VBScript runtime error '800a004c'
    Path not found

    /prova/PhotoAlbum.asp, line 135

    l'errore indica qui:
    Set objFolder = objFSO.GetFolder(strPhysicalPath)

    dai che ci riusciamo!!!!!

  10. #10
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    Probabilmente poco sopra devi cambiare questo

    codice:
     strPhysicalPath = Server.MapPath(".\" & ShowSub)
    in

    codice:
     strPhysicalPath = Server.MapPath("/" & ShowSub)
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.