//flex table opened by JP

Click to See Complete Forum and Search --> : ASP Question for ChubTub but others can answer


bahama llama
03-23-2003, 10:15 PM
Hi ChubTub, a short time ago I posted regarding dynamic page creation for images with asp. You responded with some code that would do the trick but I haven't been able to get it running. I have modified it a little to dynamically create the path for me. Here is the code you posted originally:

<%
'This would best be run in the folder that the images(thumbs are in)
'the large images would be in a subfolder called "images"
'remember to change the file type to .jpg I have .gif just for testing
'the files type needs to be changed in two areas

BuildLinks = True

ImageNumber = 1

'Path to images
MainPath = "c:\websites\test\"

Do while BuildLinks = True

'Conplete path needed starting from c:
FullPath = MainPath & cStr(ImageNumber) & ".gif"

'debugging to check actual path
'response.write FullPath & "<br>"

Set fs=Server.CreateObject("Scripting.FileSystemObject")
If (fs.FileExists(FullPath))=true Then
DisplayString = DisplayString & "<A Href='/images/" & ImageNumber & ".gif & '><img src=" & ImageNumber & ".gif alt=''></a>"
Else
Buildlinks = False
End If
set fs=nothing
ImageNumber = ImageNumber + 1
Loop

Response.write DisplayString
%>


I have modified it create the path dynamically and also have a different file structure. This file is used as in include for page in a directory that is a users name, and that folder contains two other folders, thumbs, and pics. Here is the code I have now:

<%
Dim objFSO, objFolder

Path = Server.MapPath("thumbs")

Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
Set objFolder=objFSO.GetFolder(path)

BuildLinks = True

ImageNumber = 1

Do while BuildLinks = True

response.write Path & "<br>"

Set fs=Server.CreateObject("Scripting.FileSystemObject")
If (fs.FileExists(Path))=true Then
DisplayString = DisplayString & "<A HREF='/pics/" & ImageNumber & ".jpg '><IMG SRC=/thumbs " & ImageNumber & ".jpg

alt=''></A>"
Else
Buildlinks = False
End IF
Set fs=nothing
ImageNumber = ImageNumber +1
Loop

response.Write DisplayString

%>

When I run it with the comment removed to check the path it shows the proper path, ie: C:\Inetpub\wwwroot\wedding\don\thumbs but then it displays nothing else. I am not sure what is wrong but any help is very appreciated. The folder permissions are all ok, and I have run several other test scripts out of this setup without incident. I am sure I probably typed something wrong, but any help would be great.

The next step would be split this into cells for a table and 10 images per page if you can help with that it would also be great, and please keep it simple I am still a newbie with asp.

Thanks in advance! Don.:t

DocEvi1
03-24-2003, 12:19 PM
that file I put in the other place works for me....The problem you will have doing this is that the full images are been downloaded not smaller, faster loading images that allow the user to choose which image to load.

I would suggest you get yourself a thumbnail tool (I like catalog wizard) and work from there.

Stefan