View Full Version : automated creation of list of jpegs im html - how?

12-03-2008, 12:26 PM
having a bunch of jpeg images, i need to create a html table listing all the jpegs in a folder, like

<td><img src="image1"></td>
<td><img src="image2"></td>
<td><img src="image3"></td>

is there a small software or script so i could do it?
finally i want to have something that looks like this:


thank you!

12-03-2008, 01:26 PM
Fix the link to the example please.

12-03-2008, 02:00 PM
I guess it’s this URL: http://victorboyko.com/runway/ss09/alenaakhmadullina/

But one question is: Why does it need to be a table? This ain’t abular data and images align themselves horizontally anyway so no need for a table (with just one row and an endless amount of columns). You’ll just have to put the images and space them with on line of CSS. I don’t even think if you need an automatic script for that (and I don’t know any) but a regular HTML editor with search and replace function might do it as well.

12-03-2008, 02:06 PM
The automation needs to be server-side. Might help:

$dir = 'images/'; // Base directory

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) // If directory exist
if ($dh = opendir($dir)) // If assignment successful
while (($file = readdir($dh)) !== false) // While there's still a file
if($file!='.'&&$file!='..') // I don't want to see the gibberish
echo "<td><img src='$dir$file' alt='$file'></td>"; // Echo the image inside a <td> element
} // End of the while loop
closedir($dh); // Close the directory connection
} // End of the if statement
} // End of the if statement