It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Trouble loading all images from a folder (in a certain way)

Trouble loading all images from a folder (in a certain way)

Postby gorkamolero on Wed Mar 02, 2011 2:24 pm

Hello everyone!
This is my first post. I know some html and css, but not much about javascript, and I have an existential problem with a portfolio i'm helping to design:

The portfolio itself is for a night photographer that covers different events. For each event there is a page where the photos from that event are displayed.
The thing is i don't want to write html code for each and every event, so i've been investigating how to automate this process and i've been answered: javascript.

I want a horizontal layout page for each event, where all the images from its folder are displayed, with a horizontal scrollbar and no vertical scrollbar. I've managed to cover this with a combination between css and javascript code.

The javascript code i'm using:

<script src="../../docs/js/jquery-1.2.6.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">

$(function(){
$("#page-wrap").wrapInner("<table cellspacing='30'><tr>");
$(".post").wrap("<td>");
});
</script>


Then i call for each image in the body of the html page:

<div id="page-wrap">
<div class="post">
<img src="../../images/baobab04.02.11/1.jpg" width="720" height="480" border="0" />
</div>

<div class="post">
<img src="../../images/baobab04.02.11/2.jpg" width="720" height="480" border="0" />
</div>


</div>

I've read about this function to loop for each image in a directory:

foreach(string fileName f in Directory.GetFiles("SomeDirectory"))
{
...
}


But i'm lost as to how to implement it and make a new <div class="post"> for each file in the directory.

Thank you all in advance
gorkamolero
 
Posts: 2
Joined: Wed Mar 02, 2011 2:18 pm

Who is online

Users browsing this forum: No registered users and 8 guests