Simple ASP Gallery

AMDbuilder

Limp Gawd
Joined
Nov 16, 2006
Messages
203
Hello,

I'm working on a website that's asp driven (not .net just asp) and I need to setup a basic gallery, but I haven't a clue how to go about accomplishing this as I don't do asp. The site only needs to last until August or so when I can move thing over to a php server and use a real design and such.

All I need from the script is to search the folder and then display the thumbnails in a 3x3 or 3x4 grid and link to a large preview and full size download...

The structure would be something like: (all images presized)
event/index.asp (gallery script)
event/thumb_img000099.jpg (like 150x150 thumb)
event/preview/img000099.jpg (this will open in lightbox)
event/full/img000099.jpg (download link)

I was thinking just output the thumbnails to a table and just have a download link in the cell under the image.

If it paginates the results (if that can be done in asp) that would be perfection!

Anyways I don't really know the first thing about asp other than it's a rival for php so i'm guessing similar capabilities...

Any help is very appreciated!
AMDbuilder
 
My first piece of advice is to look up FileSystemObject on devguru... or any other comparable site. If you need a piece of code to get you started, here's something I just wrote -- its not very pretty but you mentioned that you wanted the results output in a table... this will get the job done. I should also mention that if you have the ability to use .NET, there's a simple piece of code that will generate thumbnail/preview images for you on the fly.

To call it, simply indicate which directory you want to list, relative to the directory the script is running in -- for the images stored in /event/full/ ... /event/index.asp would call:

Code:
<% WriteFiles "full" %>

Here's the subroutine -- intColumns indicates the number of columns in the output table:
Code:
Sub WriteFiles(strDirectory)
	Dim intColumns: intColumns = 3
	Dim strPath: strPath = Request.ServerVariables("PATH_INFO")
	strPath = Trim(Left(strPath, InStrRev(strPath, "/")) & " ") & strDirectory
	strPath = Trim(Replace(strPath & " ", "//", "/"))
	Dim objFSO: Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
	Dim objChild, objParent: Set objParent = objFSO.GetFolder(Server.MapPath(strPath))
	Dim intCount: intCount = 0
	Response.Write "<table width=""100%"" cellpadding=""0"" cellspacing=""0"" border=""0"">" & vbCrLf
	For Each objChild In objParent.Files
		If intCount MOD intColumns = 0 Then Response.Write "	<tr>" & vbCrLf
		Response.Write "		<td width="""&FormatNumber(100/intColumns, 2)&"%"" align=""center"" valign=""middle"">" & vbCrLf
		Response.Write "			<a href=""" & objChild.Name & """ title=""" & objChild.Name & """>Image</a>" & vbCrLf
		Response.Write "		</td>" & vbCrLf
		intCount = intCount + 1
		If intCount MOD intColumns = 0 Then Response.Write "	</tr>" & vbCrLf
	Next
	If intCount MOD intColumns > 0 Then
		For intCount=(intCount MOD intColumns) To intColumns-1
			Response.Write "		<td>&nbsp;</td>" & vbCrLf
		Next
		Response.Write "	</tr>" & vbCrLf
	End If
	Response.Write "</table>" & vbCrLf
	Set objParent = Nothing
	Set objFSO = Nothing
End Sub

Like I said, its not pretty but it works just fine. As far as pagination goes, that's a whole different beast.
 
Hello,

Thanks for the help! This solution doesn't need to be perfect, but it does need to be functional and that's the important part. I will give it a try and see how far I make it with this code. As for the pagination, I kinda figured that wouldn't be easy to accomplish, but don't worry about that I can work something out.

Thanks again!
AMDbuilder
 
I went through most of those, but they had various issues such as database requirements, they need extra items installed on the server, they have administration systems, etc.

Trust me if I could have found one there that works the same I would have used it in an instant, but I didn't find anything that really worked.

AMDbuilder
 
Back
Top