Bugfix in file extension detection
[bizou.git] / index.php
index b260d73..b9b7309 100644 (file)
--- a/index.php
+++ b/index.php
@@ -9,7 +9,7 @@ function getPreview($imgFile, $maxSize = THUMB_SIZE)
        
        if (! is_file($newImgFile))
        {
-               $ext = strtolower(substr($file, -4));
+               $ext = strtolower(substr($imgFile, -4));
                if ($ext == ".jpg")
                        $img = imagecreatefromjpeg($imgFile);
                else
@@ -93,7 +93,7 @@ foreach (scandir($realDir) as $file) if ($file != '.' and $file != '..')
        {
                $ext = strtolower(substr($file, -4));
                if ($ext == ".jpg" or $ext == ".png")
-                       $imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => dirname($scriptUrlPath)."/view/$shortPath/$file" );
+                       $imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => dirname($scriptUrlPath)."/view$shortPath/$file" );
                else
                        $otherFiles[] = array( "name" => $file, "link" => dirname($scriptUrlPath)."/$realDir/$file" );
        }