Free Web Hosting PHP/mySQL
GlobalWeb.com.ru Forum Index GlobalWeb.com.ru
Free Web Hosting :: Commercial Web Hosting :: PHP/mySQL :: CGI/Perl
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Automatic Image Page with many features. (ASP)

 
Post new topic   Reply to topic    GlobalWeb.com.ru Forum Index -> ASP
Author Message
G-Bomb



Joined: 29 Feb 2004
Posts: 73

PostPosted: Sun Feb 29, 2004 7:26 pm    Post subject: Automatic Image Page with many features. (ASP) Reply with quote

These two file scripts will create an automatic picture page with many features. For this to work, you will be able to use the FileSystemObject in ASP, as well as the menubar I have posted HERE.

To begin this, you must have a folder off the root called Pictures. Then, put all of the different categories of pictures in different folders inside the Pictures folder. Name each categorial folder using underscores ( _ ) instead of spaces.

This script will then search out all of these folders and the pictures in each of those folders corresponding to your choice in the menubar, and display thumbnails of each of these pictures. Upon clicking those thumbnails, a seperate window will open showing a full-size image of your selection.


Last edited by G-Bomb on Sun Feb 29, 2004 7:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
G-Bomb



Joined: 29 Feb 2004
Posts: 73

PostPosted: Sun Feb 29, 2004 7:30 pm    Post subject: Reply with quote

Now, create this file using any name you wish:

Code:

<%@ LANGUAGE="VBSCRIPT" %>

<HTML>
<HEAD>

<%
Sub OpenFSO()
   Set fso = Server.CreateObject("Scripting.FileSystemObject")
End Sub

Sub CloseFSO()
   Set fso = Nothing
End Sub
%>

<TITLE>Photo Album</TITLE>
</HEAD>

<BODY><CENTER>
<%
f = Request.Form("f")

Dim fso
Dim theRoot
Dim FoldersArray(10)
Dim title(10)

Call OpenFSO
Set picFolder = fso.GetFolder(Server.MapPath("Pictures"))
Set theFolders = picFolder.SubFolders

i = 0
For Each aFolder In theFolders
   i = i + 1
   FoldersArray(i) = aFolder.Name
   title(i) = Replace(FoldersArray(i), "_", " ")
Next

Set theFolders = Nothing
Set picFolder = Nothing
Set theRoot = Nothing
Call CloseFSO
%>

<P STYLE="text-align:right;">
<FORM NAME="frmPictures" ACTION="#" METHOD="post">
<SELECT NAME="f" SIZE="1" onChange="if(this.options[this.selectedIndex].value != ''){ forms['frmPictures'].submit() }">
   <OPTION VALUE="">View Pictures From:</OPTION>
<%
For i = 1 To UBound(title)
%>
   <OPTION VALUE="<%= i %>"><%= title(i) %></OPTION>
<%
Next
%>
</SELECT>
</FORM>
</P>

<H4>Photo Album</H4>
<P>Click on an image to view it at full size in a separate window.
<BR>(Note: May take a few moments to load.)</P>

<%
If f <> "" Then
   Response.Write "<H3>" & title(f) & "</H3>"
   Call OpenFSO
   Set theFolder = fso.GetFolder(Server.MapPath("Pictures/" & FoldersArray(f)))
   Set theFiles = theFolder.Files

   n = 1
   For Each pic in theFiles
      Response.Write "<A HREF='showpic.asp?f=" & FoldersArray(f) & "&p=" & pic.Name & "' TARGET='_blank'>"
      Response.Write "<IMG SRC='Pictures/" & FoldersArray(f) & "/" & pic.Name & "' width='50' height='50'></A>"

      n = n + 1
      If n > 13 Then
         Response.Write "<BR>"
         n = 1
      End If
   Next
               
   Set theFiles = Nothing
   Set theFolder = Nothing
   Call CloseFSO
End If
%>

</CENTER>
</BODY>
</HTML>
Back to top
View user's profile Send private message
G-Bomb



Joined: 29 Feb 2004
Posts: 73

PostPosted: Sun Feb 29, 2004 7:31 pm    Post subject: Reply with quote

Finally create this file in the same folder as the one you just created. Call it "showpic.asp":

Code:

<%@ LANGUAGE="VBSCRIPT" %>

<HTML>
<HEAD>

<TITLE>Full-Size Picture</TITLE>
</HEAD>

<BODY>

<%
folder = Request.QueryString("f")
pic = Request.QueryString("p")
Response.Write "<IMG SRC='Pictures/" & folder & "/" &  pic & "'>"
%>

</BODY>
</HTML>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    GlobalWeb.com.ru Forum Index -> ASP All times are GMT
Page 1 of 1

 


Free Web Hosting, Commercial Web Hosting, PHP/mySQL Copyright © 2009
Free Scripts Directory | Free Software Downloads | Newsgroups Directory | Optel.net | Mirroraty | Cruised.net | Hardware Keylogger