From 3892fed82835fc5fea391d9792d832b27c757241 Mon Sep 17 00:00:00 2001 From: Marc MAURICE Date: Thu, 7 Oct 2010 22:14:05 +0200 Subject: [PATCH] Made the code template compatible for folders, images and other files --- index.php | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/index.php b/index.php index e6ab0c1..489e7b1 100644 --- a/index.php +++ b/index.php @@ -82,6 +82,7 @@ $shortPath = isset($_SERVER["PATH_INFO"]) ? $_SERVER["PATH_INFO"] : ""; if ($shortPath == '/') $shortPath = ''; $scriptUrlPath = substr($_SERVER["SCRIPT_NAME"], 0, -4); // trim .php +$folders = array(); $imageFiles = array(); $otherFiles = array(); @@ -95,35 +96,39 @@ foreach (scandir($realDir) as $file) if ($file != '.') } elseif (is_dir("$realDir/$file")) { - echo "
"; - $preview = getAlbumPreview("$realDir/$file"); - if ($preview !== '') { - echo " "; - } - - echo "$file"; - echo "
\n"; + $folders[] = array( "name" => $file, "link" => "$scriptUrlPath$shortPath/$file", "preview" => getAlbumPreview("$realDir/$file") ); } else { $mime = mime_content_type("$realDir/$file"); if ($mime == "image/jpeg") - $imageFiles[] = $file; + $imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file", 100), "link" => dirname($scriptUrlPath)."/view/$shortPath/$file" ); else - $otherFiles[] = $file; + $otherFiles[] = array( "name" => $file, "link" => dirname($scriptUrlPath)."/$realDir/$file" ); } } -foreach ($imageFiles as $file) { - echo "
\n"; -} - -foreach ($otherFiles as $file) { - echo "
$file
\n"; -} - ?> + +
+ "> + + " /> + + + +
+ + + +
+ + + +
">
+ + -- 1.7.10.4