Added config constant to use view.php or not

This commit is contained in:
Marc MAURICE 2010-10-25 00:06:54 +02:00
parent d7db66cc2d
commit 6e8404aef2

View file

@ -3,6 +3,7 @@
define('THUMB_SIZE', 100); define('THUMB_SIZE', 100);
define('DATA_DIR', 'data'); define('DATA_DIR', 'data');
define('IMAGES_DIR', 'images'); define('IMAGES_DIR', 'images');
define('USE_VIEWER', true);
function getPreview($imgFile, $maxSize = THUMB_SIZE) function getPreview($imgFile, $maxSize = THUMB_SIZE)
{ {
@ -94,11 +95,18 @@ foreach (scandir($realDir) as $file) if ($file != '.' and $file != '..')
else else
{ {
$ext = strtolower(substr($file, -4)); $ext = strtolower(substr($file, -4));
if ($ext == ".jpg" or $ext == ".png") if ($ext == ".jpg" or $ext == ".png") {
$imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => dirname($scriptUrlPath)."/view.php$shortPath/$file" ); if (USE_VIEWER)
$link = dirname($scriptUrlPath)."/view.php$shortPath/$file";
else else
$link = dirname($scriptUrlPath)."/$realDir/$file";
$imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => $link );
} else {
$otherFiles[] = array( "name" => $file, "link" => dirname($scriptUrlPath)."/$realDir/$file" ); $otherFiles[] = array( "name" => $file, "link" => dirname($scriptUrlPath)."/$realDir/$file" );
} }
}
} }
if (dirname($shortPath) !== '') if (dirname($shortPath) !== '')