Asp classic 如何显示100x75的图像,然后单击,以原始大小显示它们。ASP经典

Asp classic 如何显示100x75的图像,然后单击,以原始大小显示它们。ASP经典,asp-classic,vbscript,Asp Classic,Vbscript,下面的代码首先将文件夹显示为超链接,您可以单击这些文件夹,如果它们包含JPG的,它将显示它们 是否可以使用属性width=“100”height=“75”显示这些图像,但仍允许我单击它们并使它们显示原始大小 <% Const ForReading = 1, ForWriting = 2, ForAppending = 3 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 qfolder = reques

下面的代码首先将文件夹显示为超链接,您可以单击这些文件夹,如果它们包含JPG的,它将显示它们

是否可以使用属性width=“100”height=“75”显示这些图像,但仍允许我单击它们并使它们显示原始大小

<%
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

qfolder = request.querystring("f")
if qfolder = "" then
    folderspec = server.mappath(".")
    Set filesys = CreateObject("Scripting.FileSystemObject") 
    Set demofolder = filesys.GetFolder(folderspec) 
    Set folcoll = demofolder.SubFolders
    For Each subfol in folcoll
        folsize = left((subfol.size/1000000), 3)
        folist = folist & "<a href='?f=" & subfol.name & "'><strong title='view'></strong> " & subfol.Name & "" & vbcrlf
        folist = folist & "<BR>"  
    Next
    set filesys = nothing
    Response.Write folist

else

filepath = server.mappath(".") & "\" & qfolder
captionfile = filepath & "\captions.txt"
Set filesys = CreateObject("Scripting.FileSystemObject")
Dim SomeArray()
'caption part
    If filesys.FileExists(captionfile) then
        set file = filesys.GetFile(captionfile)
        Set TextStream = file.OpenAsTextStream(ForReading,TristateUseDefault)
        captioncount = 0
        Do While Not TextStream.AtEndOfStream
            Line = TextStream.readline
            ReDim Preserve SomeArray(captioncount)
            SomeArray(captioncount) = line
            'response.write captioncount & " " & somearray(captioncount) & "<br>"
            captioncount = captioncount + 1
            'Response.write Line
        Loop
        textStream.close
    end if

'folder part
    Set demofolder = filesys.GetFolder(filepath) 
    Set filecoll = demofolder.Files
    filecount = 0
    For Each file in filecoll
        Ext = UCase(Right(File.Path, 3)) 
        If Ext = "JPG" OR Ext = "GIF" Then
        on error resume next
        data = SomeArray(filecount)
        on error goto 0
        hrefpath = qfolder & "/" & file.name
        imagepath = "<strong>" & data & "</strong><br><a href='" & hrefpath & "' title='free image gallery' border=0><img src='" & hrefpath & "' border='" & border_size & "' title=""" & data & """ style='border-color: " & border_color & ";'></a><br>"
        filist = filist & imagepath & vbcrlf
        filist = filist & "<BR>"
        filecount = filecount + 1
        data = ""
        end if
    Next
    set filesys = Nothing
    filist = filist & "<br><small><a href='http://www.allscoop.com/' target='_blank'>allscoop free image gallery</a></small>"
%>

<h3><a href="." title="up one level">&#171;</a>
&nbsp;<%=qfolder%></h3>

<p><%=filist%></p>

<% end if %>
<%
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

qfolder = request.querystring("f")
if qfolder = "" then
    folderspec = server.mappath(".")
    Set filesys = CreateObject("Scripting.FileSystemObject") 
    Set demofolder = filesys.GetFolder(folderspec) 
    Set folcoll = demofolder.SubFolders
    For Each subfol in folcoll
        folsize = left((subfol.size/1000000), 3)
        folist = folist & "<a href='?f=" & subfol.name & "'><strong title='view'></strong> " & subfol.Name & "" & vbcrlf
        folist = folist & "<BR>"  
    Next
    set filesys = nothing
    Response.Write folist

else

filepath = server.mappath(".") & "\" & qfolder
captionfile = filepath & "\captions.txt"
Set filesys = CreateObject("Scripting.FileSystemObject")
Dim SomeArray()
'caption part
    If filesys.FileExists(captionfile) then
        set file = filesys.GetFile(captionfile)
        Set TextStream = file.OpenAsTextStream(ForReading,TristateUseDefault)
        captioncount = 0
        Do While Not TextStream.AtEndOfStream
            Line = TextStream.readline
            ReDim Preserve SomeArray(captioncount)
            SomeArray(captioncount) = line
            'response.write captioncount & " " & somearray(captioncount) & "<br>"
            captioncount = captioncount + 1
            'Response.write Line
        Loop
        textStream.close
    end if

'folder part
    Set demofolder = filesys.GetFolder(filepath) 
    Set filecoll = demofolder.Files
    filecount = 0
    For Each file in filecoll
        Ext = UCase(Right(File.Path, 3)) 
        If Ext = "JPG" OR Ext = "GIF" Then
        on error resume next
        data = SomeArray(filecount)
        on error goto 0
        hrefpath = qfolder & "/" & file.name
        imagepath = "<strong>" & data & "</strong><br><a href='" & hrefpath & "' title='free image gallery' border=0><img width=100 height=75 src='" & hrefpath & "' border='" & border_size & "' title=""" & data & """ style='border-color: " & border_color & ";'></a><br>"
        filist = filist & imagepath & vbcrlf
        filist = filist & "<BR>"
        filecount = filecount + 1
        data = ""
        end if
    Next
    set filesys = Nothing
    filist = filist & "<br><small><a href='http://www.allscoop.com/' target='_blank'>allscoop free image gallery</a></small>"
%>

<h3><a href="." title="up one level">&#171;</a>
&nbsp;<%=qfolder%></h3>

<p><%=filist%></p>

<% end if %>


谢谢

您需要更新创建标记的单行:

imagepath = "<strong>" & data & "</strong><br><a href='" & hrefpath & _
       "' title='free image gallery' border=0><img width=100 height=75 src='" &_
       hrefpath & "' border='" & border_size & "' title=""" & data &_
       """ style='border-color: " & border_color & ";'></a><br>"
imagepath=“”&data&

以防万一,这里有完整的脚本: