load plugins, and added getThumbTarget function, overloaded by viewer plugin
This commit is contained in:
parent
dee4e81d5b
commit
909133b1b0
2 changed files with 20 additions and 0 deletions
14
index.php
14
index.php
|
@ -19,6 +19,19 @@
|
||||||
|
|
||||||
require 'config.php';
|
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)
|
function getPreview($imgFile, $maxSize = THUMB_SIZE)
|
||||||
{
|
{
|
||||||
# example: data/myalbum/100.mypic.jpg
|
# example: data/myalbum/100.mypic.jpg
|
||||||
|
@ -120,6 +133,7 @@ foreach (scandir($realDir) as $file) if ($file != '.' and $file != '..')
|
||||||
$ext = strtolower(substr($file, -4));
|
$ext = strtolower(substr($file, -4));
|
||||||
if ($ext == ".jpg" or $ext == ".png") {
|
if ($ext == ".jpg" or $ext == ".png") {
|
||||||
$link = dirname($scriptUrlPath)."/$realDir/$file";
|
$link = dirname($scriptUrlPath)."/$realDir/$file";
|
||||||
|
$link = getThumbTarget("$shortPath/$file");
|
||||||
|
|
||||||
$imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => $link );
|
$imageFiles[] = array( "name" => $file, "url" => getPreview("$realDir/$file"), "link" => $link );
|
||||||
|
|
||||||
|
|
6
plugins/viewer/functions.php
Normal file
6
plugins/viewer/functions.php
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
function getThumbTarget($imageSimplePath)
|
||||||
|
{
|
||||||
|
return dirname($_SERVER["SCRIPT_NAME"])."/plugins/viewer/view.php$imageSimplePath";
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in a new issue