By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,537 Members | 1,750 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,537 IT Pros & Developers. It's quick & easy.

load images from file

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a

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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.