diff --git a/index.php b/index.php index 317c383..f333e5a 100644 --- a/index.php +++ b/index.php @@ -289,41 +289,27 @@ $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" => "
  • $label_loading" . $filename_caption . "
  • "); + $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"; - - $files[] = array ( - "name" => $file, + $imgopts = "src=\"{$imgUrl}\""; + } + $files[] = array ( + "name" => $file, "date" => filemtime($currentdir . "/" . $file), "size" => filesize($currentdir . "/" . $file), - "html" => "
  • $label_loading" . $filename_caption . "
  • "); } - } + "html" => "
  • $label_loading" . $filename_caption . "
  • "); + } // Other filetypes $extension = ""; if (preg_match("/.pdf$/i", $file)) $extension = "PDF"; // PDF