madHatter
05-14-2003, 08:53 PM
Hello
I have a simple image gallery (5 small photos in total). If the visitor clicks the next link, he is redirected to the next photo, etc.
The photos are actually photos taken of web sites, and while I wouldn't want the actual photos to be a link to the web site they belong to, I would like a link under the photo, so that when clicked, it would take the vicitor to that photo's respective web site.
Would I just normal HTML for that?
I am copying and pasting the code here to give an idea of how the gallery functions.
Thanks for any suggestions.
madHatter
<%Option Explicit%>
<%Response.Buffer = "True"%>
<HTML>
<HEAD>
<TITLE>portfolio</TITLE>
</HEAD>
<BODY>
<%
'Dim all the variables required here
Dim objFSO 'Creates an instance of the file system object
Dim objFolder 'Gets the current folder
Dim objFile 'Gets the current file
Dim Path 'Stored images
Dim Series 'Pix location
Dim ImageCount 'No of images
Dim ImageNumber 'Number of image displayed
Dim NextImage 'Next image link
Dim PreviousImage 'Previous image link
Dim FileExtention 'Grabs the file extention (".jpg")
Dim ErrorPage 'In the case of error
'Set the counter to zero
ImageCount = 0
ErrorPage = "index1.asp?GalleryError=True"
Set Path = Request.QueryString("Path")
Set Series = Request.QueryString("Series")
If Path = "" OR Series = "" Then
Response.Redirect(ErrorPage)
End If
If ImageCount = 0 Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Server.MapPath(Path & "/" & Series))
For Each objFile In objFolder.Files
FileExtention = LCase(Right((objFile.Name), 4))
If FileExtention = ".jpg" Then
ImageCount = Cint(ImageCount) + 1
End If
Next
'Destroy the objects
Set objFSO = Nothing
Set objFolder = Nothing
Set objFile = Nothing
End If
ImageNumber = Cint(Request.QueryString("ImageNumber"))
If ImageNumber < 1 Then
ImageNumber = 1
ElseIf ImageNumber > ImageCount Then
ImageNumber = ImageCount
End If
'This function generates the "previous" & "next" buttons
Function Buttons(ImageCount, ImageNumber)
If ImageNumber = 1 Then
NextImage = "<A HREF=""gallery1.asp?Path=" & Path & "&Series=" & Series & "&ImageNumber=" & (ImageNumber + 1) & """>next</A>"
PreviousImage = "previous"
ElseIf ImageNumber > 1 AND ImageNumber < ImageCount Then
NextImage = "<A HREF=""gallery1.asp?Path=" & Path & "&Series=" & Series & "&ImageNumber=" & (ImageNumber + 1) & """>next</A>"
PreviousImage = "<A HREF=""gallery1.asp?Path=" & Path & "&Series=" & Series & "&ImageNumber=" & (ImageNumber - 1) & """>previous</A>"
Else
NextImage = "next"
PreviousImage = "<A HREF=""gallery1.asp?Path=" & Path & "&Series=" & Series & "&ImageNumber=" & (ImageNumber - 1) & """>previous</A>"
End If
Buttons = PreviousImage & " | " & NextImage
End Function
%>
<TABLE WIDTH="300">
<TR>
<TD WIDTH="300" ALIGN="Right">
<%
'Displays the current image number, and total number of images
Response.Write("<H1>Image " & ImageNumber & " of " & ImageCount & "</H1><BR>")
%>
</TD>
</TR>
<TR>
<TD WIDTH="300" ALIGN="Right">
<%
Response.Write("<IMG SRC=""" & Path & "/" & Series & "/" & Series & "_" & ImageNumber & ".jpg" & """>")
%>
</TD>
</TR>
<TR>
<TD WIDTH="300" ALIGN="Right">
<%=Buttons(ImageCount, ImageNumber)%>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
I have a simple image gallery (5 small photos in total). If the visitor clicks the next link, he is redirected to the next photo, etc.
The photos are actually photos taken of web sites, and while I wouldn't want the actual photos to be a link to the web site they belong to, I would like a link under the photo, so that when clicked, it would take the vicitor to that photo's respective web site.
Would I just normal HTML for that?
I am copying and pasting the code here to give an idea of how the gallery functions.
Thanks for any suggestions.
madHatter
<%Option Explicit%>
<%Response.Buffer = "True"%>
<HTML>
<HEAD>
<TITLE>portfolio</TITLE>
</HEAD>
<BODY>
<%
'Dim all the variables required here
Dim objFSO 'Creates an instance of the file system object
Dim objFolder 'Gets the current folder
Dim objFile 'Gets the current file
Dim Path 'Stored images
Dim Series 'Pix location
Dim ImageCount 'No of images
Dim ImageNumber 'Number of image displayed
Dim NextImage 'Next image link
Dim PreviousImage 'Previous image link
Dim FileExtention 'Grabs the file extention (".jpg")
Dim ErrorPage 'In the case of error
'Set the counter to zero
ImageCount = 0
ErrorPage = "index1.asp?GalleryError=True"
Set Path = Request.QueryString("Path")
Set Series = Request.QueryString("Series")
If Path = "" OR Series = "" Then
Response.Redirect(ErrorPage)
End If
If ImageCount = 0 Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Server.MapPath(Path & "/" & Series))
For Each objFile In objFolder.Files
FileExtention = LCase(Right((objFile.Name), 4))
If FileExtention = ".jpg" Then
ImageCount = Cint(ImageCount) + 1
End If
Next
'Destroy the objects
Set objFSO = Nothing
Set objFolder = Nothing
Set objFile = Nothing
End If
ImageNumber = Cint(Request.QueryString("ImageNumber"))
If ImageNumber < 1 Then
ImageNumber = 1
ElseIf ImageNumber > ImageCount Then
ImageNumber = ImageCount
End If
'This function generates the "previous" & "next" buttons
Function Buttons(ImageCount, ImageNumber)
If ImageNumber = 1 Then
NextImage = "<A HREF=""gallery1.asp?Path=" & Path & "&Series=" & Series & "&ImageNumber=" & (ImageNumber + 1) & """>next</A>"
PreviousImage = "previous"
ElseIf ImageNumber > 1 AND ImageNumber < ImageCount Then
NextImage = "<A HREF=""gallery1.asp?Path=" & Path & "&Series=" & Series & "&ImageNumber=" & (ImageNumber + 1) & """>next</A>"
PreviousImage = "<A HREF=""gallery1.asp?Path=" & Path & "&Series=" & Series & "&ImageNumber=" & (ImageNumber - 1) & """>previous</A>"
Else
NextImage = "next"
PreviousImage = "<A HREF=""gallery1.asp?Path=" & Path & "&Series=" & Series & "&ImageNumber=" & (ImageNumber - 1) & """>previous</A>"
End If
Buttons = PreviousImage & " | " & NextImage
End Function
%>
<TABLE WIDTH="300">
<TR>
<TD WIDTH="300" ALIGN="Right">
<%
'Displays the current image number, and total number of images
Response.Write("<H1>Image " & ImageNumber & " of " & ImageCount & "</H1><BR>")
%>
</TD>
</TR>
<TR>
<TD WIDTH="300" ALIGN="Right">
<%
Response.Write("<IMG SRC=""" & Path & "/" & Series & "/" & Series & "_" & ImageNumber & ".jpg" & """>")
%>
</TD>
</TR>
<TR>
<TD WIDTH="300" ALIGN="Right">
<%=Buttons(ImageCount, ImageNumber)%>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>