Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pulling unknown amount of files from your drive for display... 1

Status
Not open for further replies.

Ovatvvon

Programmer
Feb 1, 2001
1,514
0
0
US
Hey,

Situation:
We have terascan software at work to pull satellite imagery in from noaa, goes, and dmsp birds up in the atmosphere. When we pull them down, we ftp them to our webserver. We also have doppler radar, from which we ftp our product images to the webserver. The radar is named in sequential format, as in, the type of product it is, and then the date and time it was created. The satellite images we can name whatever we want.

Question:
Is there anyway to have the web page scan an unknown amount of images in a folder and pull them up, or I guess I could integrate them into links to those images for pilots and others to view them? I'm not worried about the displaying part, it's the matter of how to find them on the drive. I want an automated task to happen consitently, rather than having one person sit there all day, every day, renaming images as they are automatically ftp'd over, and then adding them statically to the web page, ya know? that is too much, there has to be a way to do it...

Anyone know how?
Thanks in advance! Anyone can answer this for me definatly get's the magical star!! :)



-Ovatvvon :-Q
 
Use the FileSystemObject to return the 'files' collection from the folder with the images (I am assuming you know the path to the images in the example) and iterate in a loop through the collection setting a string var with all the html.


<%
'function that returns images in a 2 col table

Public Function GetImagesTable(strPathName, strRelativePath)

Dim objFSO, objFiles, objFile
Dim tmp_r

Set objFSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)

If objFSO.FolderExists(strPathName) Then

Set objFiles = objFSO.GetFolder(strPathName).Files

tmp_r = &quot;<TABLE>&quot;
For Each objFile In objFiles
If (objFile.Type = &quot;JPG Image&quot; OR _
objFile.Type = &quot;GIF Image&quot;) Then

tmp_r = tmp_r & &quot;<tr><td>&quot;
tmp_r = tmp_r & &quot;<img src='&quot; & _
strRelativePath & objFile.Name & _
&quot;' height='100' width='100'>
tmp_r = tmp_r & &quot;</td></tr>&quot;
End If
Next
tmp_r = &quot;</TABLE>&quot;

Else
tmp_r = &quot;Folder Does Not Exist&quot;
End If

GetImagesTable = tmp_r

End Function

'Function Call
Response.Write GetImagesTable(&quot;C:\images_dir\&quot;,&quot;/images/&quot;)

%>

PS I didn't explicit test this post back if you have an issue with it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top