Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Knocking on the right door?

Status
Not open for further replies.

madHatter1

Technical User
Feb 27, 2003
54
GB
Hello

Several weeks ago a kind member here offered the public some ASP script on how to contruct a photo gallery. I have been unable to contact him since, so I expect he has found pastures new.

Anyway, I am hoping to develop this script. Basically, it is a photo gallery with the following:

Image 2 of 4

PHOTO

Previous | Next

the Image 2 of 4 is not a link, but it does move with the sequence of photos.

On the other hand, Previous | Next is a link, enabling the visitor to move back or forward to the next image.

What I wish to o is to move the Previous | Next ABOVE the image and, most importantly, to have the text associated with the image, for instance, BELOW it and which would also be a hyperlink for the visitor to click on.

Photo 2 would have a different link, for example, underneath it....and so on, so that as the visitor clicks on Previos | Next the photo displays its related text (as a Web address).

What I am asking here is this: am I right in thinking that this could be done as:

If photo1= photo 1
then photo 1 =
or

if photo2 = photo2
then photo2 =
etc

end if

I would be grateful for any advice here.

Here is the original script:

<%Option Explicit%>
<%Response.Buffer = &quot;True&quot;%>

<HTML>
<HEAD>

<BODY>
<%


Dim objFSO
Dim objFolder
Dim objFile
Dim Path
Dim Series
Dim ImageCount
Dim ImageNumber
Dim NextImage
Dim PreviousImage
Dim FileExtention
Dim ErrorPage

ImageCount = 0

Set Path = Request.QueryString(&quot;Path&quot;)
Set Series = Request.QueryString(&quot;Series&quot;)
If Path = &quot;&quot; OR Series = &quot;&quot; Then
Response.Redirect(ErrorPage)
End If

If ImageCount = 0 Then
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set objFolder = objFSO.GetFolder(Server.MapPath(Path & &quot;/&quot; & Series))
For Each objFile In objFolder.Files
FileExtention = LCase(Right((objFile.Name), 4))
If FileExtention = &quot;.jpg&quot; Then
ImageCount = Cint(ImageCount) + 1
End If
Next

Set objFSO = Nothing
Set objFolder = Nothing
Set objFile = Nothing
End If

ImageNumber = Cint(Request.QueryString(&quot;ImageNumber&quot;))
If ImageNumber < 1 Then
ImageNumber = 1
ElseIf ImageNumber > ImageCount Then
ImageNumber = ImageCount
End If

'This function generates the &quot;previous&quot; & &quot;next&quot; buttons
Function Buttons(ImageCount, ImageNumber)
If ImageNumber = 1 Then
NextImage = &quot;<A HREF=&quot;&quot;gallery1.asp?Path=&quot; & Path & &quot;&Series=&quot; & Series & &quot;&ImageNumber=&quot; & (ImageNumber + 1) & &quot;&quot;&quot;>next</A>&quot;
PreviousImage = &quot;previous&quot;
ElseIf ImageNumber > 1 AND ImageNumber < ImageCount Then
NextImage = &quot;<A HREF=&quot;&quot;gallery1.asp?Path=&quot; & Path & &quot;&Series=&quot; & Series & &quot;&ImageNumber=&quot; & (ImageNumber + 1) & &quot;&quot;&quot;>next</A>&quot;
PreviousImage = &quot;<A HREF=&quot;&quot;gallery1.asp?Path=&quot; & Path & &quot;&Series=&quot; & Series & &quot;&ImageNumber=&quot; & (ImageNumber - 1) & &quot;&quot;&quot;>previous</A>&quot;
Else
NextImage = &quot;next&quot;
PreviousImage = &quot;<A HREF=&quot;&quot;gallery1.asp?Path=&quot; & Path & &quot;&Series=&quot; & Series & &quot;&ImageNumber=&quot; & (ImageNumber - 1) & &quot;&quot;&quot;>previous</A>&quot;
End If
Buttons = PreviousImage & &quot; | &quot; & NextImage
End Function
%>

<TABLE WIDTH=&quot;300&quot;>
<TR>
<TD WIDTH=&quot;300&quot; ALIGN=&quot;Right&quot;>
<%
'Displays the current image number, and total number of images
Response.Write(&quot;<H1>Image &quot; & ImageNumber & &quot; of &quot; & ImageCount & &quot;</H1><BR>&quot;)
%>
</TD>
</TR>
<TR>
<TD WIDTH=&quot;300&quot; ALIGN=&quot;Right&quot;>
<%
'Displays the current image.
Response.Write(&quot;<IMG SRC=&quot;&quot;&quot; & Path & &quot;/&quot; & Series & &quot;/&quot; & Series & &quot;_&quot; & ImageNumber & &quot;.jpg&quot; & &quot;&quot;&quot;>&quot;)
%>
</TD>
</TR>
<TR>
<TD WIDTH=&quot;300&quot; ALIGN=&quot;Right&quot;>
<%=Buttons(ImageCount, ImageNumber)%>
</TD>
</TR>

</TABLE>

</BODY>
</HTML>

Many thanks again - I know this is a tall order!

Hatter
 
Hi
So the format you want would look like:
Previous | Next

PHOTO

Image 2 of 4


<CODE>
<TABLE WIDTH=&quot;300&quot;>
<TR>
<TD WIDTH=&quot;300&quot; ALIGN=&quot;Right&quot;>
<%=Buttons(ImageCount, ImageNumber)%>
</TD>
</TR>
<TR>
<TD WIDTH=&quot;300&quot; ALIGN=&quot;Right&quot;>
<%
'Displays the current image.
Response.Write(&quot;<IMG SRC=&quot;&quot;&quot; & Path & &quot;/&quot; & Series & &quot;/&quot; & Series & &quot;_&quot; & ImageNumber & &quot;.jpg&quot; & &quot;&quot;&quot;>&quot;)
%>

</TD>
</TR>
<BR>
<%
dim str_link
dim str_name
if ImageNumber = 1 then
str_link = &quot; else
........
end if
%>
<P><A href=&quot; <TR>

</TR>
<TR>
<TD WIDTH=&quot;300&quot; ALIGN=&quot;Right&quot;>
<%
'Displays the current image number, and total number of images
Response.Write(&quot;<H1>Image &quot; & ImageNumber & &quot; of &quot; & ImageCount & &quot;</H1><BR>&quot;)
%>

</TD>
</TR>

</TABLE>

</BODY>
</HTML>
</CODE>

Only problem with the above is that you must create an If for every picture.The only why I can think of to avoid the static programming is to use a database to hold the links name.
 
Hello CorenI

Wow! You've given me plenty of food for thought!
Let me experiment a little with what you suggest and I'll be back soon!

Much appreciated.

Hatter
 
Was this the post you were thinking of?

thread770-515354

this is the link to the original gallery

And you can see the code running here (somewhat modified)
or here in a less altered state

the ASP slideshow code is a seperate setup from the gallery BTW

Chris.


Indifference will be the downfall of mankind, but who cares?
 
Hello Chris

Yes, all those links look interesting, too!

Hatter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top