# Posted By

pashky on 05/17/09

# Statistics

Viewed 431 times
Favorited by 0 user(s)

# Image directory index

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
`<? \$title = htmlspecialchars("Guy Fawkes Nights at EBI Campus & Cambridge 4-5.11.2008"); ?><html><head><title><?= \$title ?></title><style type="text/css">body { background: #666666;color: #cccccc;font-family: tahoma, verdana, sans-serif;padding: 30px; }img { border: 1px solid #cccccc;margin-right: 30px;vertical-align:top; }h1 { font-size: 30pt;font-weight: bold;margin-bottom:50px; }div { font-size: 10pt; }span { font-size: 30pt;font-weight: bold;font-family: impact,tahoma,sans-serif;color: #888888; }a:link,a:hover,a:active,a:visited { color: #cccccc; text-decoration:underline}</style></head><body><h1><?= \$title ?></h1><p><a href="../">back to list</a></p><?// just a comment to test and remove \$cwd = opendir('.');if(!\$cwd) die("can't open dir!"); \$desc = array();if(file_exists('descript.ion'))	foreach(file('descript.ion') as \$line)		if(preg_match('/^(\\S+)\\s+(.*?)\\s*\$/', \$line, \$d))			\$desc[\$d[1]] = \$d[2]; \$images = array();while(\$file = readdir(\$cwd)){	if(preg_match('/\\.(jpe?g|gif|png)\$/i', \$file) && is_readable(\$file))	{		list(\$width, \$height, \$type) = getimagesize(\$file);		if(\$width && \$height)		{			\$images[\$file] = array(\$width, \$height);		}	}} \$names = array_keys(\$images);sort(\$names);\$k = 0;foreach(\$names as \$img){	\$i = \$images[\$img];	?>        <p><img src="<?=\$img?>" width="<?=\$i[0]?>" height="<?=\$i[1]?>" alt=""><span><?=++\$k?></span><div><?=htmlspecialchars(\$desc[\$img])?></div></p>	<?}?></body></html>`