Adapt viewer
plugin to absolute paths
This commit is contained in:
parent
02479196c6
commit
304e0f09d7
1 changed files with 9 additions and 3 deletions
|
@ -24,7 +24,13 @@ require "$bizouRootFromHere/functions.php";
|
||||||
// extract /path/to/image.jpg from /view.php/path/to/image.jpg
|
// extract /path/to/image.jpg from /view.php/path/to/image.jpg
|
||||||
$simpleImagePath = getPathInfo();
|
$simpleImagePath = getPathInfo();
|
||||||
|
|
||||||
if (! is_file("$bizouRootFromHere/".IMAGES_DIR.$simpleImagePath)) {
|
$imageBaseDir = "$bizouRootFromHere/".IMAGES_DIR;
|
||||||
|
if (IMAGES_DIR[0] == '/') {
|
||||||
|
$imageBaseDir = IMAGES_DIR;
|
||||||
|
}
|
||||||
|
$imagePath = $imageBaseDir . $simpleImagePath;
|
||||||
|
|
||||||
|
if (! is_file($imagePath)) {
|
||||||
header("HTTP/1.1 404 Not Found");
|
header("HTTP/1.1 404 Not Found");
|
||||||
die("File Not Found");
|
die("File Not Found");
|
||||||
}
|
}
|
||||||
|
@ -32,7 +38,7 @@ if (! is_file("$bizouRootFromHere/".IMAGES_DIR.$simpleImagePath)) {
|
||||||
// get all images in an array
|
// get all images in an array
|
||||||
$images = array();
|
$images = array();
|
||||||
|
|
||||||
$files = scandir("$bizouRootFromHere/".IMAGES_DIR.dirname($simpleImagePath));
|
$files = scandir($imageBaseDir . dirname($simpleImagePath));
|
||||||
foreach ($files as $file) if ($file[0] != '.')
|
foreach ($files as $file) if ($file[0] != '.')
|
||||||
{
|
{
|
||||||
$ext = strtolower(substr($file, -4));
|
$ext = strtolower(substr($file, -4));
|
||||||
|
@ -59,7 +65,7 @@ if (substr($bizouRootUrl, -1) !== '/') $bizouRootUrl.='/'; // add a trailing /
|
||||||
// bizouRootUrl = /path/to/bizou/
|
// bizouRootUrl = /path/to/bizou/
|
||||||
|
|
||||||
// template variables
|
// template variables
|
||||||
$imageUrl = $bizouRootUrl.IMAGES_DIR.$simpleImagePath;
|
$imageUrl = $bizouRootUrl.IMAGES_URL.$simpleImagePath;
|
||||||
|
|
||||||
if ($nextImage === '') {
|
if ($nextImage === '') {
|
||||||
$nextImageUrl = '';
|
$nextImageUrl = '';
|
||||||
|
|
Loading…
Reference in a new issue