473,881 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying the images in the folder

27 New Member
Hi ,
I am creating a web page in ASP. I will place some images in the folder,
The images placed in the folder should be disaplayed. I am having the two button in the web page if I click next button then the next image should be dispalyed, If i click prev button then the prev image in the folder shd be displayed.The images are not static... its if today i hav 10 images afetr some time i amy hav 15 images....

Pls help me...

Thanks in advance
Nov 29 '07 #1
7 1994
Sonasang
27 New Member
Displaying the images in the folder
--------------------------------------------------------------------------------

Hi ,
I am creating a web page in ASP. I will place some images in the folder,
The images placed in the folder should be disaplayed. I am having the two button in the web page if I click next button then the next image should be dispalyed, If i click prev button then the prev image in the folder shd be displayed.The images are not static... its if today i hav 10 images afetr some time i amy hav 15 images....

Pls help me...

Thanks in advance
Nov 30 '07 #2
shweta123
692 Recognized Expert Contributor
Hi,

To display the images on web page , you can use FileSystemObjec t.

<%

Dim obj
Dim folder
Dim file

'''''Create FileSystemObjec t

Set obj = Server.CreateOb ject("Scripting .FileSystemObje ct")

'''''''Get the folder folder for your image path

Set folder = obj.GetFolder(f olderpath)

'''''''Get each file in that folder

For Each file In folder.Files%>
<img src =<%= file.path%>>
<%Next%>

Displaying the images in the folder
--------------------------------------------------------------------------------

Hi ,
I am creating a web page in ASP. I will place some images in the folder,
The images placed in the folder should be disaplayed. I am having the two button in the web page if I click next button then the next image should be dispalyed, If i click prev button then the prev image in the folder shd be displayed.The images are not static... its if today i hav 10 images afetr some time i amy hav 15 images....

Pls help me...

Thanks in advance
Dec 3 '07 #3
Sonasang
27 New Member
Hi Swetha,

Thanks a lot for ur reply and help....
Its working fine....

It is displaying all the images in the same page......

Thanks a lot
Dec 5 '07 #4
Nicodemas
164 Recognized Expert New Member
It's a good solution, but he did say he wanted previous/next buttons.

this should work, though, i did not test it.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. '//----------------------------------------------------
  3. '// declare some constants and variables
  4. '//----------------------------------------------------
  5. dim oFileSystem, oFolder, nFile, i, aFilenames, lookUp
  6.  
  7. i = 0
  8. const IMAGE_DIRECTORY = "/path_to_my_image_directory/"
  9.  
  10. '//----------------------------------------------------
  11. '// set up FSO
  12. '//----------------------------------------------------
  13. set oFileSystem = server.createobject("scripting.filesystemobject")
  14.  
  15. '//----------------------------------------------------
  16. '// get all images in image directory, store filenames
  17. '// in array
  18. '//----------------------------------------------------
  19. set oFolder = oFileSystem.getFolder(server.mappath(IMAGE_DIRECTORY))
  20.  
  21. '//----------------------------------------------------
  22. '// resize array to fit number of files in directory
  23. '//----------------------------------------------------
  24. redim aFilenames(oFolder.files.count - 1)
  25.  
  26. '//----------------------------------------------------
  27. '// loop through files in folder, assign each to
  28. '// index in array
  29. '//----------------------------------------------------
  30. for each nFile in oFolder.files
  31.    aFilenames(i) = nFile.name
  32.    i = i + 1
  33. next
  34.  
  35. set oFolder = nothing
  36. set oFileSystem = nothing
  37.  
  38. '//----------------------------------------------------
  39. '//determine which image the user wants to look at
  40. '//----------------------------------------------------
  41. if request.querystring("pic") <> "" and isnumber(request.querystring("pic")) then
  42.    lookUp = cint(request.querystring("pic"))
  43.    '//----------------------------------------------------
  44.    '// make sure the value of lookUp doesn't break
  45.    '// our array bounds
  46.    '//----------------------------------------------------
  47.    if (lookUp < 0 or lookUp > ubound(aFilenames)) then 
  48.       lookUp = 0
  49.    end if
  50. else
  51.    lookUp = 0
  52. end if
  53. %>
  54.  
  55. <html>
  56. <body>
  57.    <img src="<%= IMAGE_DIRECTORY %><%= aFilenames(lookUp) %>" />
  58.    <br />
  59.    <a href="?pic=<%= lookUp - 1 %>"><< Previous</a> &nbsp; <a href="?pic=<%= lookUp + 1 %>">Next >></a>
  60.  
  61. </body>
  62. </html>
Dec 7 '07 #5
Sonasang
27 New Member
It's a good solution, but he did say he wanted previous/next buttons.

this should work, though, i did not test it.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. '//----------------------------------------------------
  3. '// declare some constants and variables
  4. '//----------------------------------------------------
  5. dim oFileSystem, oFolder, nFile, i, aFilenames, lookUp
  6.  
  7. i = 0
  8. const IMAGE_DIRECTORY = "/path_to_my_image_directory/"
  9.  
  10. '//----------------------------------------------------
  11. '// set up FSO
  12. '//----------------------------------------------------
  13. set oFileSystem = server.createobject("scripting.filesystemobject")
  14.  
  15. '//----------------------------------------------------
  16. '// get all images in image directory, store filenames
  17. '// in array
  18. '//----------------------------------------------------
  19. set oFolder = oFileSystem.getFolder(server.mappath(IMAGE_DIRECTORY))
  20.  
  21. '//----------------------------------------------------
  22. '// resize array to fit number of files in directory
  23. '//----------------------------------------------------
  24. redim aFilenames(oFolder.files.count - 1)
  25.  
  26. '//----------------------------------------------------
  27. '// loop through files in folder, assign each to
  28. '// index in array
  29. '//----------------------------------------------------
  30. for each nFile in oFolder.files
  31.    aFilenames(i) = nFile.name
  32.    i = i + 1
  33. next
  34.  
  35. set oFolder = nothing
  36. set oFileSystem = nothing
  37.  
  38. '//----------------------------------------------------
  39. '//determine which image the user wants to look at
  40. '//----------------------------------------------------
  41. if request.querystring("pic") <> "" and isnumber(request.querystring("pic")) then
  42.    lookUp = cint(request.querystring("pic"))
  43.    '//----------------------------------------------------
  44.    '// make sure the value of lookUp doesn't break
  45.    '// our array bounds
  46.    '//----------------------------------------------------
  47.    if (lookUp < 0 or lookUp > ubound(aFilenames)) then 
  48.       lookUp = 0
  49.    end if
  50. else
  51.    lookUp = 0
  52. end if
  53. %>
  54.  
  55. <html>
  56. <body>
  57.    <img src="<%= IMAGE_DIRECTORY %><%= aFilenames(lookUp) %>" />
  58.    <br />
  59.    <a href="?pic=<%= lookUp - 1 %>"><< Previous</a> &nbsp; <a href="?pic=<%= lookUp + 1 %>">Next >></a>
  60.  
  61. </body>
  62. </html>



Hi ,

Thanks a lot for ur timely help .. I will check it and let u know...

Thanks again
Dec 14 '07 #6
Sonasang
27 New Member
Hi ,
Its working well. Thanks a lot.
Dec 18 '07 #7
Nicodemas
164 Recognized Expert New Member
You're welcome :D I am happy it worked out for you.
Dec 18 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

24
4706
by: Mark Sargent | last post by:
Hi All, response.write FilePath gives this path, ImageName.jpeg but the image(s) doesn't display in the below code. What am I missing..? Cheers. <%Response.Write FilePath%> Original Image:<BR> <IMG SRC="<%=Server.MapPath("ImageUploads\") & FilePath%>"><P> Thumbnail (50% reduction):<BR>
3
3608
by: Michel | last post by:
Hi, This is my first post and I may be asking a question that's got a very simple explanation. I hope. I'm building a website and testing it goes fine on Netscape and Mozilla. Pixel perfect.
7
2349
by: Vinay | last post by:
Hi All: I have a small application that stores images either in the database or as files (depending on the user preference). I'm in the process of providing a web interface to this application. 1. If the images are stored in the DB then, every an image is requested, it will need to be pulled out and a temp file created and then displayed? What is the best way to do this?
15
22330
by: Jameson | last post by:
Happy New Year, Everyone! I am trying to figure out how to display a bunch of images (mainly JPEGs, but possibly a few GIFs and PNGs as well) that are stored in a local directory on the system. I can do this with the glob() function, but I can't seem to put in a directory other than one within the webroot. For example, I can only put "/uploads" and not "/Volumes/jray/Pictures...". Any ideas how to get around this? If I can't use the...
8
1780
by: Lloyd Sheen | last post by:
I have a list of JPG's which are found in a SQL Server database. When the page selects a certain piece of data it will refer to the file system (resident on IIS server with a virtual directory) and files contained within a certain folder. I have been trying for quite a while to set the ImageURL of an image control to the correct information. I have googled till my mind hurts but can find nothing to help. I have even tried to copy the...
5
4016
by: kbnolan | last post by:
I'm somewhat new to this so I know there is something easy I'm missing. I'm editing an existing html page that was built with primarily with css. I have to work with the existing structure and not change it. The background is in this style #content-wrapper-1 { background-color: #d8f5fd; background-image: url(/images/backgrounds/content-1.png); background-repeat: repeat-y; background-position: center 0;
11
4436
by: Marge | last post by:
After importing a VB6 project into Express 2008 I have two gif's with transparency do not display correctly. In VB6 these pictures where used with the image object which had different properties to the picturebox unfortunately there only seems to be the picturebox option in the toolbox of Express 2008? any ideas/help PLEASE :o)
3
7759
by: mvijayrkumar | last post by:
Hi to all.... Guys pls help me..... I have an image issue in RLDC while hosting my project on server.The image displays or works fine with the local system.But when hosted on server,both the images(One coming from DataSet and another from my project image folder) not displaying. Both images are having Type property External and the Values are given correspondingly.ie The One coming from Image Folder;using the Report Parameter ,the...
5
9433
by: Ca1icoJack | last post by:
I'm new to Javascript and want to write a script which will loop through the files in a folder and display them in a webpage. I've written the following which alternately displays two images in a folder, but I want to be able to add new files to that folder and have them added to this loop. I'm assuming I just need some code to populate the list of files in the folder, but don't know how to do that, nor how to make var have a variable max...
0
9927
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10717
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10814
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10401
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9552
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7953
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4597
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4196
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.