Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 9th, 2005, 07:00 PM
Authorized User
 
Join Date: Jan 2005
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default Photo album with slide show

Hey everyone...I am looking for a point in the right direction.

1. I want to create a thumbnail gallery from all of the gifs and jpegs in a certain folder...no other types of files.

2. I then want to have a popup window when the thumbnail is clicked to show the "real" image.

3. and last but not least I would like to have a previous button and a next button so that they can keep the popup window open and scroll through the pictures.

I have seen a couple of examples with VBscript online but I am not very VBscript savvy and most do not have the previous and next buttons.

A working script would be awesome.
 
Old August 9th, 2005, 07:25 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Do you have photo shop? allot of people create them here (static versions only) Its amazing how it works, in about three seconds it batch processors a dir containing images into exactly what you are looking for, forward and back button and all.

You need to be VBScript savvy to create a dynamic version, is this what you want?. I doubt if someone will give you the server side code for one. This is a place to get problematic you have written sorted, not a place to get code written for you. Make a start, when you come accross a problem post it for assistance. Its amazing the help you will get here if its obvious you have 'had a go'

how to get a new window opening by clicking an image:

1..The function - put in the head of your document
 <script>
    var newWindow
    function openNewWin(pageURL, pageName, width, height, top, left)
    {
          newWindow = window.open(pageURL, pageName,"width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + ",scrollbars=1, resizable=1,toolbar=0,location=0,status=1,menubar= 0");
          newWindow.focus()
    }
 </script>

2..The link - put anywhere
<a href="#" onClick="openNewWin('pageNameWherelargeImageSits.a sp','SomeWindowName',650,450,130,180);" title="Click To See Largr Image"><img src="images/thumbNailName.gif" border="0"></a>

<!-- NOTE :
650 = window width,450 = window height,130 = x coords,180 = y coords

create a page called 'pageNameWherelargeImageSits.asp' what ever you place here will appear in the new window-->





Wind is your friend
Matt
 
Old August 9th, 2005, 07:45 PM
Authorized User
 
Join Date: Jan 2005
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I pulled this script off of another forum which I think is exactly waht I need but I get the error below any ideas.

here is the code

<%
Dim objFSO, objfile, objFolder, i, folder
Set folder=request("folder")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If request("folder")="" Then
Set objFile = objFSO.GetFile(Server.MapPath(Request.ServerVariab les("PATH_INFO")))
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files
For each Folder in objFolder.SubFolders
If UCase(Left(Folder.Name,1)) = "0" OR "1" Then Response.Write("<a href='index.asp?folder=" & Folder.Name & "'>" & Folder.Name & "</a><br><br>")
Next
Else
Set objFolder = objFSO.GetFolder(Server.MapPath("" & folder & "/"))
Response.Write(folder & "<br><br><table width=500 border=0 cellspacing=1 cellpadding=1><tr>")
i = -1
files = 0
For Each objFile in objFolder.Files
If UCase(Right(objFile.Name,4)) = ".JPG" or UCase(Right(objFile.Name,4)) = ".GIF" Then
i = i + 1
If i = 3 Then
    Response.Write("</tr><tr><td width=160 height=110 align=center valign=middle><a href=""javascript:imagewindow('" & objFile.Name & "')""><img src='" & folder & "/" & objFile.Name & "' height=105 border=0></a></td>")
    i= 0
    Else
    Response.Write("<td width=160 height=110 align=center valign=middle><a href=""javascript:imagewindow('" & objFile.Name & "')""><img src='" & folder & "/" & objFile.Name & "' height=105 border=0></a></td>")
End If
files=files+1 'total number of files
End If
Next
Response.Write("</tr></table>")
%>
             <script language="JavaScript">
<!--
function imagewindow(filename)
{
popupWin = window.open('image.asp?folder=<%=folder%>&files=<% =files%>&filename=' + filename,'image','width=540,height=540,left=0,top= 0,screenX=0,screenY=0')
}
-->
</script>
             <%
End If
Set objFSO = Nothing
%>

here is the error

Microsoft VBScript compilation error '800a03ee'

Expected ')'

/index.asp, line 6

Set objFile = objFSO.GetFile(Server.MapPath(Request.ServerVariab les("PATH_INFO")))

help?

 
Old August 9th, 2005, 08:17 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

There is a big difference between:
ServerVariab les

and
ServerVariables


Wind is your friend
Matt
 
Old August 9th, 2005, 08:19 PM
Authorized User
 
Join Date: Jan 2005
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, not vbscript savvy here. What does that mean?

 
Old August 9th, 2005, 08:24 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

There is no such thing as ServerVariab les - change it to ServerVariables

Wind is your friend
Matt
 
Old August 9th, 2005, 09:04 PM
Authorized User
 
Join Date: Jan 2005
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oh duh didn't see that

 
Old August 11th, 2005, 12:00 PM
Authorized User
 
Join Date: Jan 2005
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok I started over with something new using the FileSystemObject

<%
  'Create the FileSystemObject object
  Dim objFSO
  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

  'Obtain a folder object instance for a particular directory
  Dim objFolder
  Set objFolder = objFSO.GetFolder("C:\blah\pictures\")

  'Use a For Each ... Next loop to display the files
  Dim objFile
  For Each objFile in objFolder.Files
     'Print out the name
     Response.Write objFile.Path & "<BR>"
  Next
%>


ok now...I need to add the href tag to each objFile to create a popup window...I know this should be simple Javascript...but how do I get the popup window to have a next and back buttons that can scroll through the files in the directory "pictures" dynamically without having a seperate page for each picture?







Similar Threads
Thread Thread Starter Forum Replies Last Post
Photo Album Questions m3ben BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 April 4th, 2007 12:12 PM
Error posting photo to photo album abel714 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 10 February 5th, 2007 03:07 AM
Wrox Photo Album Help rsearing BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 6 September 27th, 2006 02:30 PM
Photo Album Menus Tremmorkeep BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 August 15th, 2006 01:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.