/    Sign up×
Community /Pin to ProfileBookmark

access a folder of images

hi all,

i’m new to javascript but very familliar with scripting and programming.

i was wondering if there is some way i can loop round all of the images in a folder and then display them.

i would be thinking of code looking like this;

var im= nextImage();
while (im != null)
{
document.write
(“<a href=’images_folder/im’><img src=’images_folder/im’ alt=” /></a>”);
document.write(“<br />”);
im= nextImage();
}

the function nextImage() is one i have invented out of thin air which would move through all of the images in a folder one after the other.

obvioulsy this is quite a high-level solution but i was wondering if anyone knows how to do this.

i would have done this using php and mysql but i can’t get free web space to do this. i wouldn’t know how to do it using an applet either.

thanks

john

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JAug 17.2005 — Unfortunately, to my knowledge, you cannot do this with Javascript
Copy linkTweet thisAlerts:
@felgallAug 17.2005 — You will need to have the list of images in an array in order to be able to process them like this as Javascript doesn't have access to read/write files or directories. If you can use a server side language you could use that to read in the directory content into the array.

I have an example of code that does something like this using PHP and Javascript on my page http://www.felgall.com/php10.htm

That page creates a link to a random web page from within the specified directory which is not quite the same as what you are trying to do but modifying that code to process all images instead of one randomly selected htm would be fairly simple.
×

Success!

Help @johnmcp spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...