Der sker ik ret meget, andet end før.
koden er nu:
<html>
<head>
<title>Hovedsiden</title>
</head>
<body>
<?php
//http://www.eksperten.dk/spm/691753
$allowPics = array("gif","jpeg","jpg","jpe");
setlocale( LC_ALL, "da", "dan", "da_DK", "da_DK.ISO8859-1", "danish" );
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Strict //EN\" \"
http://www.w3.org/TR/html4/strict.dtd\">\n";echo "<html>\n";
echo "<head>\n";
echo "<title>Upload Test</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">\n";
echo "</head>\n";
echo "<body>\n";
echo "<div id=\"content\">\n";
echo "<h1>Gallery</h1>\n";
$fileArray = array();
$uploaddir = getcwd() . "/upload";
// Open a known directory, and proceed to read its contents
if (is_dir($uploaddir))
{
if ($dh = <html>
<head>
<title>Hovedsiden</title>
</head>
<body>
<?php
//http://www.eksperten.dk/spm/691753
$allowPics = array("gif","jpeg","jpg","jpe");
setlocale( LC_ALL, "da", "dan", "da_DK", "da_DK.ISO8859-1", "danish" );
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Strict //EN\" \"
http://www.w3.org/TR/html4/strict.dtd\">\n";echo "<html>\n";
echo "<head>\n";
echo "<title>Upload Test</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">\n";
echo "</head>\n";
echo "<body>\n";
echo "<div id=\"content\">\n";
echo "<h1>Gallery</h1>\n";
$fileArray = array();
$uploaddir = getcwd() . "/upload";
// Open a known directory, and proceed to read its contents
if (is_dir($uploaddir))
{
if ($dh = opendir($uploaddir))
{
while (($file = readdir($dh)) !== false)
{
$fullPath = $uploaddir . "/" . $file;
echo "Fullpath: " . $fullPath . "<br>";
if(is_file($fullPath))
{
$ext = strtolower(end(explode(".",$file)));
echo "Extension: " . $ext . "<br>";
echo "Fil: " . $file . "<br>";
if(in_array($ext,$allowPics))
{
$fileArray[filemtime($fullPath)] = $file;
}
}
}
closedir($dh);
}
}
$kolonner = 3;
$antalImages = count($fileArray);
if($antalImages > 0)
{
krsort($fileArray);
echo "<table id=\"centerTable\">\n";
echo "<tr>\n";
$i = 0;
foreach($fileArray as $time => $file)
{
if(!($i%$kolonner) && $i>0 && $i < $antalImages)
{
$tmp .= "</tr>\n<tr>\n";
}
$tmp .= "<td><img src=\"upload/".$file."\" title=\"Billedet er uploadet: ".strftime("%e. %B %Y - %T",$time)."\" alt=\"".basename($file)."\"></td>\n";
$i++;
}
for($i=0; $antalImages % $kolonner && $i<$kolonner-($antalImages % $kolonner); $i++)
{
$tmp .= "<td> </td>\n";
}
$tmp .= "</tr>\n</table>";
echo $tmp;
}
else
{
echo "Vi har ikke uploadet nogle billeder endnu, de kommer...";
}
echo "</div>\n";
echo "</body>\n";
echo "</html>\n";
?>
</body>
</html>
www.dannymator.dk/hcc/image/test2.php