"/" in the uri must never be urlencoded, it breaks opening files completely.
also remove some code repetition.
This commit is contained in:
parent
9d70a14d07
commit
652eaac128
1 changed files with 17 additions and 31 deletions
42
index.php
42
index.php
|
@ -289,40 +289,26 @@ $dirs = array();
|
|||
if (is_file($currentdir.'/'.$file.'.html')) {
|
||||
$img_captions[$file] = $file.'::'.htmlspecialchars(file_get_contents($currentdir.'/'.$file.'.html'),ENT_QUOTES);
|
||||
}
|
||||
$linkUrl = rawurlencode("$currentdir/$file");
|
||||
$imgParams = http_build_query(
|
||||
array(
|
||||
'filename' => "$thumbdir/$file",
|
||||
'size' => $thumb_size
|
||||
),
|
||||
'',
|
||||
'&'
|
||||
);
|
||||
$imgUrl = GALLERY_ROOT . "createthumb.php?$imgParams";
|
||||
if ($lazyload) {
|
||||
$linkUrl = urlencode("$currentdir/$file");
|
||||
$imgParams = http_build_query(
|
||||
array(
|
||||
'filename' => "$thumbdir/$file",
|
||||
'size' => $thumb_size
|
||||
),
|
||||
'',
|
||||
'&'
|
||||
);
|
||||
$imgUrl = GALLERY_ROOT . "createthumb.php?$imgParams";
|
||||
|
||||
$files[] = array (
|
||||
"name" => $file,
|
||||
"date" => filemtime($currentdir . "/" . $file),
|
||||
"size" => filesize($currentdir . "/" . $file),
|
||||
"html" => "<li><a href={$linkUrl} rel='lightbox[billeder]' title=\"".htmlentities($img_captions[$file])."\"><img class=\"b-lazy\" src=data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== data-src=\"$imgUrl\" alt='$label_loading' /></a>" . $filename_caption . "</li>");
|
||||
$imgopts = "class=\"b-lazy\" src=data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== data-src=\"$imgUrl\"";
|
||||
} else {
|
||||
$linkUrl = urlencode("$currentdir/$file");
|
||||
$imgParams = http_build_query(
|
||||
array(
|
||||
'filename' => "$thumbdir/$file",
|
||||
'size' => $thumb_size
|
||||
),
|
||||
'',
|
||||
'&'
|
||||
);
|
||||
$imgUrl = GALLERY_ROOT . "createthumb.php?$imgParams";
|
||||
|
||||
$imgopts = "src=\"{$imgUrl}\"";
|
||||
}
|
||||
$files[] = array (
|
||||
"name" => $file,
|
||||
"date" => filemtime($currentdir . "/" . $file),
|
||||
"size" => filesize($currentdir . "/" . $file),
|
||||
"html" => "<li><a href=\"{$linkUrl}\" rel='lightbox[billeder]' title=\"".htmlentities($img_captions[$file])."\"><img src=\"{$imgUrl}\" alt='$label_loading' /></a>" . $filename_caption . "</li>"); }
|
||||
"html" => "<li><a href=\"{$linkUrl}\" rel='lightbox[billeder]' title=\"".htmlentities($img_captions[$file])."\"><img $imgopts alt='$label_loading' /></a>" . $filename_caption . "</li>");
|
||||
}
|
||||
// Other filetypes
|
||||
$extension = "";
|
||||
|
|
Loading…
Reference in a new issue