472,325 Members | 1,500 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,325 software developers and data experts.

load images from file

I would like to know how to load images from a file using JavaScript.

path = = root/images/kitchens/web

all files are jpeg

I would like to be able to loop through the file and capture all the file
names then concat the path name infront of the file into an array.

Could someone show me what I need to know please?

--

Totus possum, totum Deum.
Totus ero, totum meum.
WSW
Oct 5 '06 #1
4 3215

Aquosus wrote:
I would like to know how to load images from a file using JavaScript.

path = = root/images/kitchens/web

all files are jpeg

I would like to be able to loop through the file and capture all the file
names then concat the path name infront of the file into an array.

Could someone show me what I need to know please?
There are many examples and solutions if you search for them on the
web. Here's one example:

var imgs = new Array(
"path/name1.ext",
"path/name2.ext",
"path/name3.ext");

var pre_img = new Array();

for (var i = 0; i < imgs.length; i++)
{
pre_img[i] = new Image();
pre_img[i].src = imgs[i];
}

That's all it takes. Of course, there are some optimizations that can
be done, but since you have not provided enough context, the above
should suffice.

Oct 5 '06 #2
web.dev wrote:
Aquosus wrote:
>I would like to know how to load images from a file using JavaScript.

path = = root/images/kitchens/web

all files are jpeg

I would like to be able to loop through the file and capture all the
file names then concat the path name infront of the file into an
array.

Could someone show me what I need to know please?

There are many examples and solutions if you search for them on the
web. Here's one example:

var imgs = new Array(
"path/name1.ext",
"path/name2.ext",
"path/name3.ext");

var pre_img = new Array();

for (var i = 0; i < imgs.length; i++)
{
pre_img[i] = new Image();
pre_img[i].src = imgs[i];
}

That's all it takes. Of course, there are some optimizations that can
be done, but since you have not provided enough context, the above
should suffice.
I think I was not clear enough

I would like to use a loop to capture all the names of images in a given
folder

/*psudeo code below*/

var imgs =new Array();
var i=0;
do
{
imgs[i]= new Image();
imgs[i++]="root/images/kitchens/web" imgName; //How do I capture the name
of each image here????
}while(NotEndOfFile)//How do I read the end of file
I know I can do this with C++ so I suppose it can be done with JavaScript.
Once this is done I can do what your letter showed me. Thanks for your help

--

Totus possum, totum Deum.
Totus ero, totum meum.
WSW
Oct 5 '06 #3
You can't access the server directly. I do this via JavaScript XmlHttp
services... You need some server side code to serve some data. I would
suggest you just have the server send you a nice XML tree and then load
that into JavaScript to play with it.

On Oct 5, 5:58 pm, "Aquosus" <2U_LeaveMe_Al...@hotmail.comwrote:
web.dev wrote:
Aquosus wrote:
I would like to know how to load images from a file using JavaScript.
path = = root/images/kitchens/web
all files are jpeg
I would like to be able to loop through the file and capture all the
file names then concat the path name infront of the file into an
array.
Could someone show me what I need to know please?
There are many examples and solutions if you search for them on the
web. Here's one example:
var imgs = new Array(
"path/name1.ext",
"path/name2.ext",
"path/name3.ext");
var pre_img = new Array();
for (var i = 0; i < imgs.length; i++)
{
pre_img[i] = new Image();
pre_img[i].src = imgs[i];
}
That's all it takes. Of course, there are some optimizations that can
be done, but since you have not provided enough context, the above
should suffice.I think I was not clear enough

I would like to use a loop to capture all the names of images in a given
folder

/*psudeo code below*/

var imgs =new Array();
var i=0;
do
{
imgs[i]= new Image();
imgs[i++]="root/images/kitchens/web" imgName; //How do I capture the name
of each image here????
}while(NotEndOfFile)//How do I read the end of file

I know I can do this with C++ so I suppose it can be done with JavaScript.
Once this is done I can do what your letter showed me. Thanks for your help

--

Totus possum, totum Deum.
Totus ero, totum meum.
WSW
Oct 5 '06 #4
On Oct 5, 5:58 pm, "Aquosus" <2U_LeaveMe_Al...@hotmail.comwrote:
>web.dev wrote:
>>Aquosus wrote:
I would like to know how to load images from a file using
JavaScript.
>>>path = = root/images/kitchens/web
>>>all files are jpeg
>>>I would like to be able to loop through the file and capture all
the file names then concat the path name infront of the file into
an array.
>>>Could someone show me what I need to know please?
>>There are many examples and solutions if you search for them on the
web. Here's one example:
>>var imgs = new Array(
"path/name1.ext",
"path/name2.ext",
"path/name3.ext");
>>var pre_img = new Array();
>>for (var i = 0; i < imgs.length; i++)
{
pre_img[i] = new Image();
pre_img[i].src = imgs[i];
}
>>That's all it takes. Of course, there are some optimizations that
can be done, but since you have not provided enough context, the
above should suffice.I think I was not clear enough

I would like to use a loop to capture all the names of images in a
given folder

/*psudeo code below*/

var imgs =new Array();
var i=0;
do
{
imgs[i]= new Image();
imgs[i++]="root/images/kitchens/web" imgName; //How do I capture
the name of each image here????
}while(NotEndOfFile)//How do I read the end of file

I know I can do this with C++ so I suppose it can be done with
JavaScript. Once this is done I can do what your letter showed me.
Thanks for your help

--

Totus possum, totum Deum.
Totus ero, totum meum.
WSW
ag******@gmail.com wrote:
You can't access the server directly. I do this via JavaScript
XmlHttp services... You need some server side code to serve some
data. I would suggest you just have the server send you a nice XML
tree and then load that into JavaScript to play with it.
So I should use PHP then, thanks

--

Totus possum, totum Deum.
Totus ero, totum meum.
WSW
Oct 6 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Trevor Fairchild | last post by:
I am making a program that categorizes pictures. The picture paths are stored in an Access Database, vb6 connects using adodc controls. This...
5
by: Ben Long | last post by:
Hi All, A partner of mine has been charged with identifying a performance / load problem currently experienced on one of our websites. I'm...
3
by: Torrent | last post by:
When Trying to Load an XSLT File with the XslTransform i got a rather annoying Exception being thrown "System.Xml.XPath.XPathException: XsltContext...
4
by: Ed Sutton | last post by:
I have been searching for how to get an icon resource and load it into an ImageList. I added an *.ico file to my project and set the files "Build...
12
by: Sharon | last post by:
I’m wrote a small DLL that used the FreeImage.DLL (that can be found at http://www.codeproject.com/bitmap/graphicsuite.asp). I also wrote a small...
5
by: iainfogg | last post by:
I had an ASP.NET 2.0 site which works fine on my PC. I have just copied it to a server, and set it up to run in a virtual folder. The web pages work...
0
by: mrjaxon | last post by:
Basically the issue is, when the XSL style sheet is loaded by URI it is cool but when the exact same style sheet loaded by it's contents the load...
1
by: Tea Maker | last post by:
Hi, Is there a way in actionscript, to tell a specific button to load the image from a folder that exist in the same root of the flash file? ...
2
elamberdor
by: elamberdor | last post by:
Hi All! Well, i'm modifying a dynamic map, with lat and long datapoints, my problem is it loads in text perfectly onto exact points I specify on...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.