ASP Source Code: Mulvey Family Photo Album - gallery.asp
<%@ language = "vbscript" %>
<%
option explicit
Response.Buffer = True
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> 
<!--#include Virtual="/IncFiles/adovbs.inc"-->
<!--#include Virtual="/IncFiles/mulveyDSN.inc"-->
<!--#include Virtual="/IncFiles/getCaption.inc"-->
<!--#include Virtual="/IncFiles/toHTML.inc"-->
<!--#include Virtual="/IncFiles/navTree.inc"-->
<!--#include Virtual="/IncFiles/hitCount.inc"-->

<%

'Mulvey Family Photo Album with Thumbnails and Captions by Allen Mulvey 05-2000

dim tbl
dim conn
dim rs
dim strSQL
dim PageID
dim flag
dim FSO
dim fs
dim Pass
dim subPath
dim topPath
dim topLevel
dim HeaderTitle
dim FolderTitle
dim Caption
dim Body
dim i
dim j
dim arr
dim arrSize
dim navStr
dim tmp
dim root
Dim previous


'============================================================

' Edit the definitions in this section and
' change the mailto at the bottom of the page

' ******** Define the default top level photo folder
topLevel="The_Mulveys"

topPath=server.MapPath(topLevel)

' ******** Dimension and define the DSN-less connection string (mulveyDSN) in the include file mulveyDSN.inc
'	You will probably want to rename this file and search and replace all occurrences of "mulvey."
'	I name the file and the string variable after the database so I can keep several in the same folder.

'============================================================

i = InStrRev(topPath,"\")

'Get the root path
root = Mid(topPath,1,i)

subPath = Request("subPath")
if subPath = "" then
	subPath=topPath
	HeaderTitle = topLevel
else
	Set FSO = CreateObject("Scripting.FileSystemObject")
	if FSO.FolderExists(subpath) = False then
		subPath=topPath
		HeaderTitle = topLevel
	end if
	set FSO = nothing
end If

j = InStrRev(subPath,"\")
if j > 0 then
	previous = Mid(subPath,1,j-1)
else
	previous = topPath
end if

PageID = Mid(subPath,i+1)

arr = split(subPath,"\",-1,1)
arrSize = uBound(arr)

hitCount(pageID)

Pass = 0

'Get graphic file information and create display tables
Sub GetFiles(Folder)
	on error resume next
	Dim Path
	Dim Folders
	dim SubFolders
	Dim Files
	Dim RootName
	Dim gType
	Dim Path_1
	Dim Path_2
	Dim SubFolder
	Dim File
	Dim cap
	Dim pathT
	Dim noPhot

	'Get the relative path
	Path = mid(Folder,i+1)

	'Strip the path from the folder name for display purposes
	'If you don't use HeaderTitle's names you might not want to do this
	HeaderTitle = Path
	i = InStrRev(Path,"\")
	if i > 0 then
		HeaderTitle = mid(Path,i+1)
	end if

	Set FSO = CreateObject("Scripting.FileSystemObject")
	set Folders=FSO.GetFolder(Folder)
	Set SubFolders = Folders.SubFolders
	Set Files = Folders.Files

	getCaption Folder,HeaderTitle,2

	response.write "<hr size=5 width=" & chr(34) & "60%" & chr(34) & " align=" & chr(34) & "center" & chr(34) & "><p>" & vbNewLine
	response.write Caption & "<p>" & vbNewLine
	i = Files.Count
	if Flag = true then i = i-1 end if       'Don't count the Caption file
	If i > 0 Then

		response.write "<table align=center>" & vbNewLine
		response.write "<tr><th align=center><h4>Caption<br>Size</h4></th>" & vbNewLine
		response.write "<th align=""center"" width=""200""><h4>Image</h4></th></tr>" & vbNewLine
		
		For Each File In Files
			'Get only gif and jpeg thumbnail files
			'My thumbnails have "_t" at the end of the root file name
			if NOT (UCase(Right(File.Name,6)) = "_T.GIF" or UCase(Right(File.Name,6)) = "_T.JPG") then
				if UCase(Right(File.Name,4)) = ".GIF" or UCase(Right(File.Name,4)) = ".JPG" then
					RootName = Left(File.Name,Len(File.Name)-4)
					gType = Right(File.Name,4)
					response.write "<tr>"
					response.write "<td align=center>"

					tmp = root & Path
					getCaption tmp,RootName,1
					response.write Caption
					response.write "<br>" & File.Size & " bytes</td>" & vbNewLine
					response.write "<td align=center>"
					response.write "<a href=" & chr(34) & "DisplayImage.asp?ImageName=" & path & "\" & rootname & gtype & chr(34)
					response.write " target="& chr(34) & rootname & chr(34)
					response.write ">" & vbNewLine
'					response.write " alt=" & chr(34) & RootName & chr(34) & ">" & vbNewLine
					response.write "<img src=" & chr(34) & Path & "\" & RootName & "_t" & gType & chr(34)
					response.write " alt=" & chr(34) & RootName & " Thumbnail" & chr(34) & ">"
					response.write "</a>"
					response.write "</td></tr>" & vbNewLine
				end if
			end if
		Next
		response.write "</table>" & vbNewLine

		Pass = 0
		noPhot = False
	Else
		noPhot = True
	End If

	'Print a bottom bar
	response.Write "<p><hr size=5 width=" & chr(34) & "60%" & chr(34) & " align=" & chr(34) & "center" & chr(34) & ">" & vbNewLine

	if not (HeaderTitle=topLevel) then
		response.write  "<FORM ACTION="
		response.write  chr(34) & "gallery.asp" & chr(34)
		response.write  " METHOD=POST>" & vbNewLine
		response.write  "<input name=" & chr(34) & "submit" & chr(34)
		response.write  " type=submit value=" & chr(34) & "Go to Top Level" & chr(34) & ">" & vbNewLine
		response.write  "</form>" & vbNewLine

		response.write  "<FORM ACTION="
		response.write  chr(34) & "gallery.asp?subpath=" & Server.URLEncode( previous) & chr(34)
		response.write  " METHOD=POST>" & vbNewLine
		response.write  "<input name=" & chr(34) & "submit" & chr(34)
		response.write  " type=submit value=" & chr(34) & "Go Up One Level" & chr(34) & ">" & vbNewLine
		response.write  "</form>" & vbNewLine
	end if

	'Recursively check for subfolders
	If SubFolders.Count > 0 Then

		For Each SubFolder In SubFolders

			FolderTitle = SubFolder
			i = InStrRev(SubFolder,"\")
			if i > 0 then
				FolderTitle = mid(SubFolder,i+1)
			end if

			getCaption subFolder,FolderTitle,0

			response.write  "<FORM ACTION="
			response.write  chr(34) & "gallery.asp?subPath="& Server.URLEncode(SubFolder) & chr(34)
			response.write  " METHOD=POST>" & vbNewLine
			response.write  "<input name=" & chr(34) & "submit" & chr(34)
			response.write  " type=submit value=" & chr(34) & Caption & chr(34) & ">" & vbNewLine
			response.write  "</form>" & vbNewLine
		next
	else
		if noPhot = True then
			response.Write "<p>There are no photographs at this location." & vbNewLine
		end if
	end if
	response.write "<hr size=5 width=" & chr(34) & "60%" & chr(34) & " align=" & chr(34) & "center" & chr(34) & ">" & vbNewLine
	set Folders = nothing
	set FSO = nothing
End Sub

%>

<html>

<head>
	<META NAME="AUTHOR" CONTENT="Allen Mulvey">
	<LINK rel="stylesheet" type="text/css" href="/incfiles/styles.css">
	<title>Mulvey Family Photo Gallery</title>
</head>

<body>

<center>
<h2 align="center">Mulvey Family Photo Gallery</h2>
<p>
Click the thumbnail for a larger image.
<br> 
The photographs will appear in another window.
<p>
<%
'Pass the name of the subfolder containing the photographs to the subroutine
getfiles subPath
%>

<p>
<IMG SRC="images/Camera.gif" Border="0" Width="32" Height="32" alt="Navigation Map">
<br clear="all">
<h4>Navigation Map</h4>

<table><tr><td align="left">
<%
navTree topPath, 1
%>
</td></tr></table>

<p>
<hr size=5 width="60%" align="center">
<p>
<h3>Notes</h3>
<p>
The respective Photographers retain the copyright to all images linked
to these pages.


<%
'=======================================================================
'Place information which is to be only on the top level page in the section below
if HeaderTitle=topLevel then
%>
<p>
<hr size=5 width="60%" align="center">
<p>
<FORM ACTION="guestbook.asp" METHOD="get">
<input name="submit" type="submit" value="Our Guest Book">
</form>
<p>
<hr size=5 width="60%" align="center">
<p>
<h3>Links</h3>
<p>
<table align=center>

<tr>
<td align="center" colspan="3">
<A HREF="http://www.amulvey.com/Jars_of_Clay.asp" target="_blank">
<IMG SRC="images/PSALM119.png" ALT="Psalm 119" Border="0" Width="139" Height="220">
<br clear="all">Other things of interest.</a>
</td>
</tr>

<tr>
<td align=center colspan="3">
<IMG SRC="images/SinglePixel.gif" Border="0" Width="1" Height="10" Alt="Spacer">
</td>
</tr>

<tr>
<td align=center>
<A HREF="http://www.stjohnslcms.com" target="_blank">
<IMG SRC="images/StJohnsText2.gif" ALT="St. John's Evangelical LCMS" Border="0" Width="210" Height="150">
<br clear="all">St. John's Evangelical LCMS<br>
Rome, NY 13440</A>
</td>

<td>
<IMG SRC="images/SinglePixel.gif" Border="0" Width="20" Height="1" Alt="Spacer">
</td>

<td align=center>
<A HREF="http://www.lcms.org" target="_blank">
<IMG SRC="images/lcms-cross.gif" ALT="LCMS Cross" Border="0" Width="100" Height="118">
<br clear="all">We worship with<br>
The Lutheran Church - Missouri Synod</a>
</td>
</tr>

<tr>
<td align=center colspan="3">
<IMG SRC="images/SinglePixel.gif" Border="0" Width="1" Height="10" Alt="Spacer">
</td>
</tr>

</table>

<p>
<hr size=5 width="60%" align="center">
<p>

<table>
<tr>
<td align=center>
<IMG SRC="/images/SinglePixel.gif" Border="0" Width="1" Height="20" Alt="Spacer">
</td>
</tr>

<table>
<tr>
<td align=center>
<IMG SRC="images/SinglePixel.gif" Border="0" Width="1" Height="20" Alt="Spacer">
</td>
</tr>

<tr>
<td align=center>
<a href="http://www.lhm.org/" target="_blank">
<IMG SRC="images/LutheranHour.jpg" ALT="Lutheran Hour" Border="0" Width="59" Height="45">
<br clear="all">Lutheran Hour Ministries</a>
</td>
</tr>

<tr>
<td align=center>
<IMG SRC="images/SinglePixel.gif" Border="0" Width="1" Height="10" Alt="Spacer">
</td>
</tr>

<tr>
<td align=center>
</td>
</tr>

<tr>
<td align=center>
<IMG SRC="images/SinglePixel.gif" Border="0" Width="1" Height="10" Alt="Spacer">
</td>
</tr>

<tr>
<td align=center>
<A HREF="http://www.iclnet.org/pub/resources/text/wittenberg/wittenberg-home.html" target="_blank">
Project Wittenberg</a>
</td>
</tr>

<tr>
<td align=center>
<A HREF="/wittenberg/" target="_blank">
Some contributions  to Project Wittenberg</A>
</td>
</tr>

<tr>
<td align=center>
<A HREF="http://www.gospelcom.net/bible" target="_blank">The WWW Bible Gateway</a>
</td>
</tr>

<tr>
<td align=center>
<A HREF="http://www.authenticwalk.com/bibletoolbox" target="_blank">The Bible Toolbox</a>
</td>
</tr>

<tr>
<td align=center>
<A HREF="http://test.mulvey.us/" target="_blank">My Test Web Site http://test.mulvey.us</a>
</td>
</tr>

</table>
<p>
<hr size=5 width="60%" align="center">
<p>
This is a self maintaining site.
<br>
Each time this page is accessed it checks for
all available photographs and sub-folders.<br>
Sub-folders are represented by navigation buttons which will take you to that location.
<p>
To see the asp (active server page) script which produces this page
<A href="displayasp.asp?file=gallery.asp&app=Mulvey+Family+Photo+Album">click here</a>.
<br> 
To see the file which displays the individule images
<A href="displayasp.asp?file=DisplayImage.asp&app=Mulvey+Family+Photo+Album">click here</a>.
<br> 
To see the include file getCaption.inc
<A href="/incFiles/displayasp.asp?file=getCaption.inc&app=Mulvey+Family+Photo+Album">click here</a>.
<br>
To see the include file navTree.inc
<A href="/incFiles/displayasp.asp?file=navTree.inc&app=Mulvey+Family+Photo+Album">click here</a>.
<br>
To see the include file toHTML.inc
<A href="/incFiles/displayasp.asp?file=toHTML.inc&app=Mulvey+Family+Photo+Album">click here</a>.
<br>
To see the include file hitCount.inc
<A href="/incFiles/displayasp.asp?file=hitCount.inc&app=Mulvey+Family+Photo+Album">click here</a>.
<br>
To see the asp script which produces our Guestbook
<A href="displayasp.asp?file=guestbook.asp&app=Mulvey+Family+Photo+Album">click here</a>.
<br> 
To see the style sheet which formats this page
<A href="/incFiles/displayasp.asp?file=styles.css&app=Mulvey+Family+Photo+Album">click here</a>.
<br> 
To see the asp script which displays these scripts
<A href="displayasp.asp?file=displayasp.asp&app=Mulvey+Family+Photo+Album">click here</a>.
<br> 
To see a Readme.txt file about this Photo Gallery
<A href="displayasp.asp?file=Readme.txt&app=Mulvey+Family+Photo+Album">click here</a>.
<br> 
To download a zipped archive of all these files
<A href="aspGallery.zip">click here</a>.
<br> 
To download a zipped archive of a php version of this gallery
<A href="phpGallery.zip">click here</a>.
<% end if
'=======================================================================
%>

<p>
<hr size=5 width="60%" align="center">
<p>
This gallery was created on May 14, 1999 and this page has been accessed
<% =VisitorCount %>
times.
<p>
<hr size=5 width="60%" align="center">
<p>

<p>
If you have any problems or suggestions about this site please let me know.<br>
<a name=me href="Mailto:webmaster@amulvey.com?subject=Mulvey Family Photo Gallery">Allen Mulvey</a>

</body>

</html>