From: Marc MAURICE Date: Sun, 12 Dec 2010 22:35:15 +0000 (+0100) Subject: load plugins, and added getThumbTarget function, overloaded by viewer plugin X-Git-Tag: v1.2~9 X-Git-Url: http://positon.org/gitweb/?p=bizou.git;a=commitdiff_plain;h=909133b1b0693a8bf57c5f4fc0d7b28306797fef load plugins, and added getThumbTarget function, overloaded by viewer plugin --- diff --git a/index.php b/index.php index 61f5579..b464e04 100644 --- a/index.php +++ b/index.php @@ -19,6 +19,19 @@ require 'config.php'; +// load plugins +$plugins = scandir("plugins"); +array_shift($plugins); array_shift($plugins); // remove . and .. +foreach ($plugins as $p) if (is_file("plugins/$p/functions.php")) + require "plugins/$p/functions.php"; + +if (! function_exists('getThumbTarget')) { +function getThumbTarget($imageSimplePath) +{ + return dirname($_SERVER["SCRIPT_NAME"]).'/'.IMAGES_DIR.$imageSimplePath; +} +} + function getPreview($imgFile, $maxSize = THUMB_SIZE) { # example: data/myalbum/100.mypic.jpg @@ -120,6 +133,7 @@ foreach (scandir($realDir) as $file) if ($file != '.' and $file != '..') $ext = strtolower(substr($file, -4)); if ($ext == ".jpg" or $ext == ".png") { $link = dirname($scriptUrlPath)."/$realDir/$file"; + $link = getThumbTarget("$shortPath/$file"); $imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => $link ); diff --git a/plugins/viewer/functions.php b/plugins/viewer/functions.php new file mode 100644 index 0000000..3d14508 --- /dev/null +++ b/plugins/viewer/functions.php @@ -0,0 +1,6 @@ +