load plugins, and added getThumbTarget function, overloaded by viewer plugin

This commit is contained in:
Marc MAURICE 2010-12-12 23:35:15 +01:00
parent dee4e81d5b
commit 909133b1b0
2 changed files with 20 additions and 0 deletions

View file

@ -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 );

View file

@ -0,0 +1,6 @@
<?php
function getThumbTarget($imageSimplePath)
{
return dirname($_SERVER["SCRIPT_NAME"])."/plugins/viewer/view.php$imageSimplePath";
}
?>