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
7 1962
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
Hi,
To display the images on web page , you can use FileSystemObject.
<%
Dim obj
Dim folder
Dim file
'''''Create FileSystemObject
Set obj = Server.CreateObject("Scripting.FileSystemObject")
'''''''Get the folder folder for your image path
Set folder = obj.GetFolder(folderpath)
'''''''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
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
It's a good solution, but he did say he wanted previous/next buttons.
this should work, though, i did not test it. - <%
-
'//----------------------------------------------------
-
'// declare some constants and variables
-
'//----------------------------------------------------
-
dim oFileSystem, oFolder, nFile, i, aFilenames, lookUp
-
-
i = 0
-
const IMAGE_DIRECTORY = "/path_to_my_image_directory/"
-
-
'//----------------------------------------------------
-
'// set up FSO
-
'//----------------------------------------------------
-
set oFileSystem = server.createobject("scripting.filesystemobject")
-
-
'//----------------------------------------------------
-
'// get all images in image directory, store filenames
-
'// in array
-
'//----------------------------------------------------
-
set oFolder = oFileSystem.getFolder(server.mappath(IMAGE_DIRECTORY))
-
-
'//----------------------------------------------------
-
'// resize array to fit number of files in directory
-
'//----------------------------------------------------
-
redim aFilenames(oFolder.files.count - 1)
-
-
'//----------------------------------------------------
-
'// loop through files in folder, assign each to
-
'// index in array
-
'//----------------------------------------------------
-
for each nFile in oFolder.files
-
aFilenames(i) = nFile.name
-
i = i + 1
-
next
-
-
set oFolder = nothing
-
set oFileSystem = nothing
-
-
'//----------------------------------------------------
-
'//determine which image the user wants to look at
-
'//----------------------------------------------------
-
if request.querystring("pic") <> "" and isnumber(request.querystring("pic")) then
-
lookUp = cint(request.querystring("pic"))
-
'//----------------------------------------------------
-
'// make sure the value of lookUp doesn't break
-
'// our array bounds
-
'//----------------------------------------------------
-
if (lookUp < 0 or lookUp > ubound(aFilenames)) then
-
lookUp = 0
-
end if
-
else
-
lookUp = 0
-
end if
-
%>
-
-
<html>
-
<body>
-
<img src="<%= IMAGE_DIRECTORY %><%= aFilenames(lookUp) %>" />
-
<br />
-
<a href="?pic=<%= lookUp - 1 %>"><< Previous</a> <a href="?pic=<%= lookUp + 1 %>">Next >></a>
-
-
</body>
-
</html>
It's a good solution, but he did say he wanted previous/next buttons.
this should work, though, i did not test it. - <%
-
'//----------------------------------------------------
-
'// declare some constants and variables
-
'//----------------------------------------------------
-
dim oFileSystem, oFolder, nFile, i, aFilenames, lookUp
-
-
i = 0
-
const IMAGE_DIRECTORY = "/path_to_my_image_directory/"
-
-
'//----------------------------------------------------
-
'// set up FSO
-
'//----------------------------------------------------
-
set oFileSystem = server.createobject("scripting.filesystemobject")
-
-
'//----------------------------------------------------
-
'// get all images in image directory, store filenames
-
'// in array
-
'//----------------------------------------------------
-
set oFolder = oFileSystem.getFolder(server.mappath(IMAGE_DIRECTORY))
-
-
'//----------------------------------------------------
-
'// resize array to fit number of files in directory
-
'//----------------------------------------------------
-
redim aFilenames(oFolder.files.count - 1)
-
-
'//----------------------------------------------------
-
'// loop through files in folder, assign each to
-
'// index in array
-
'//----------------------------------------------------
-
for each nFile in oFolder.files
-
aFilenames(i) = nFile.name
-
i = i + 1
-
next
-
-
set oFolder = nothing
-
set oFileSystem = nothing
-
-
'//----------------------------------------------------
-
'//determine which image the user wants to look at
-
'//----------------------------------------------------
-
if request.querystring("pic") <> "" and isnumber(request.querystring("pic")) then
-
lookUp = cint(request.querystring("pic"))
-
'//----------------------------------------------------
-
'// make sure the value of lookUp doesn't break
-
'// our array bounds
-
'//----------------------------------------------------
-
if (lookUp < 0 or lookUp > ubound(aFilenames)) then
-
lookUp = 0
-
end if
-
else
-
lookUp = 0
-
end if
-
%>
-
-
<html>
-
<body>
-
<img src="<%= IMAGE_DIRECTORY %><%= aFilenames(lookUp) %>" />
-
<br />
-
<a href="?pic=<%= lookUp - 1 %>"><< Previous</a> <a href="?pic=<%= lookUp + 1 %>">Next >></a>
-
-
</body>
-
</html>
Hi ,
Thanks a lot for ur timely help .. I will check it and let u know...
Thanks again
Hi ,
Its working well. Thanks a lot.
You're welcome :D I am happy it worked out for you.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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.
|
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....
|
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....
|
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)...
|
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...
|
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...
|
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...
|
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...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
| |