Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 February 8th, 2006, 12:42 PM
Authorized User
 
Join Date: Jun 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Images in directory

Hi there,

I need to display all the images in a directory, inside a table no more that 4 columns wide (but I would like it to be easily customizable if I need to change it). It can be any number of rows, obviously depending on how many images there are.

The images will be stored in a different folder to the .asp page.

Thanks very much/...

 
Old February 15th, 2006, 04:36 AM
Friend of Wrox
 
Join Date: Nov 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

try this script and ajust it to you liking

Code:
<% 

Dim fso, sRoot 
Set fso = Server.CreateObject("Scripting.FileSystemObject") 
'put your folder here
sRoot = "c:\Temp'Server.MapPath("/")
buildTree(sRoot) 

'Functie die de lengte van het bestand zonder extensie ophaalt
Function LenghtFileMinusExtension(fileName)
    LenghtFile=Len(fileName)
    LenghtFileMinusExtension=LenghtFile -1- len(fso.GetExtensionName(fileName))
End Function

Function buildTree(path)
  Dim dl, d, fl, f,fileToString,fileOnly
  Set dl = fso.GetFolder(path).SubFolders 
  For Each d In dl
      'Response.Write  d.Name & "<br />"
  Set fl = fso.GetFolder(d.path).Files
    For Each f In fl
      'Remove Thumbs.db
      If fso.GetExtensionName(f.Name)<>"db" Then
          fileToString=Replace(f.path, sRoot, "")
        fileOnly=f.Name

        'Filename
        Response.Write(left(fileOnly,LenghtFileMinusExtension(fileOnly))&"<br />")
        'Filename and path
        'Response.Write  left(fileToString,LenghtFileMinusExtension(fileToString)) & "<br />"
      End If
    Next
  Set fl = Nothing

 
  buildTree(d.Path)  
  Next

  Set dl = Nothing
  Response.Write "</ul>" 
End Function 
 
Set fso = Nothing

'Response.Write
%>
__________________________________________________ ________
This is my junk I'm gona eat it





Similar Threads
Thread Thread Starter Forum Replies Last Post
Load Images from and Save Images to a Database cyndie VB.NET 2 August 17th, 2008 06:42 AM
deleting images from a directory using php Adam H-W Beginning PHP 1 June 7th, 2006 08:57 AM
Directory in C# raviprakash_7 C# 1 April 11th, 2005 10:33 AM
About directory mani_he PHP How-To 6 September 19th, 2004 02:10 AM
how to get sub Directory ngthhoang Visual C++ 0 November 22nd, 2003 09:51 AM





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