http://php.imagiro-1.com/Pictures You can see what I have so far. When you click on a link, it should show you thumbnails of the pictures. And some pages have errors.
And here my code:
Code: Select all
<html>
<head><title>Process all files</title></head>
<body>
<?php
$exit_test = "$exit";
//echo $exit;
$full_name = "$exit_test";
$dir_new = basename($full_name);
//session_register ("dir_new");
print "<h1>$dir_new</h1><br><hr>";
//echo $dir_final;
//Open Dir
//$dir = opendir('./') or die($php_errormsg);
$dir = opendir($exit_test) or die($php_errormsg);
while (false !== ($files =readdir($dir))) {
if ('.' == ($files)) {
continue;
}
if ('..' == ($files)) {
continue;
}
if (is_file($files)) {
continue;
}
$file[$x++] = $files;
}
closedir($dir);
foreach($file as $filenum => $filename)
{
//print "$filenum $filename <p>\n";
}
//Create Array 15
$files = array();
//Create Table
function pc_grid_horizontal($array, $size, $dir_final) {
$table_width = 100;
$width = intval($table_width / $size);
$tr = '<tr align="center">';
$td = "<td width="$width%%"><a href="pictures/Olympus Camedia/$dir_final/%s" target="window"><img="pictures/Olympus Camedia/$dir_final/%s"><br>pic</a></td>";
$grid = "<table width="$table_width%" style="table_style">$tr";
$i = 0;
foreach ($array as $e) {
$grid .= str_replace('%s', $e, $td);
$i++;
if (!($i % $size)) {
$grid .= "</tr>$tr";
}
}
while ($i % $size) {
$grid .= sprintf($td, ' ');
$i++;
}
$end_tr_len = strlen($tr) * -1;
if (substr($grid, $end_tr_len) != $tr) {
$grid .= '</tr>';
} else {
$grid = substr($grid, 0, $end_tr_len);
}
$grid .= '</table>';
return $grid;
}
$grid = pc_grid_horizontal($file, 5, $dir_new);
print $grid;
?>
?>