473,659 Members | 2,659 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 1976
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
4672
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
3598
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
2325
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
22307
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
1765
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
4006
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
4414
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
7708
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
9423
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
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
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
8525
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
7356
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...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
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
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.