Add directory Support
This commit is contained in:
parent
45e8519618
commit
75682cb2ba
4 changed files with 15 additions and 3 deletions
|
@ -22,6 +22,6 @@ $conf['defpage'] = 1;
|
|||
// Images per Page if not specified
|
||||
$conf['defslice'] = 34;
|
||||
// Default Subdirectory if none given
|
||||
$conf['defdir'] = 'r34';
|
||||
$conf['defdir'] = '';
|
||||
|
||||
?>
|
BIN
img/folder.png
Normal file
BIN
img/folder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
|
@ -36,7 +36,11 @@ if (isset($_SESSION['files'])
|
|||
{
|
||||
$files = $_SESSION['files'];
|
||||
} else {
|
||||
$files = array_diff(scandir($imagedir.$dir, SCANDIR_SORT_DESCENDING), array('..', '.'));
|
||||
$dirs = glob($imagedir.$dir.'/*' , GLOB_ONLYDIR);
|
||||
$rmdirs = $dirs;
|
||||
$rmdirs[] = '.';
|
||||
$rmdirs[] = '..';
|
||||
$files = array_diff(scandir($imagedir.$dir, SCANDIR_SORT_DESCENDING), $rmdirs);
|
||||
$_SESSION['files'] = $files;
|
||||
$_SESSION['dir'] = $dir;
|
||||
$_SESSION['cachetime'] = time();
|
||||
|
@ -60,7 +64,7 @@ $files = array_reverse($files);
|
|||
// Get Files for current Page
|
||||
$curfiles = array_slice($files, ($page-1)*$slice ,$slice, true);
|
||||
|
||||
if (count($curfiles) > 0) {
|
||||
if (count($curfiles) > 0 | count($dirs) > 0) {
|
||||
// Prepare Generic Data for Template
|
||||
$data['galleryname'] = $galleryname;
|
||||
$data['startpage'] = $_SERVER['PHP_SELF'];
|
||||
|
@ -83,6 +87,7 @@ if (count($curfiles) > 0) {
|
|||
$tmp['i'] = $index+1;
|
||||
$tmp['t'] = $thumburl.$t->get_thumb($image);
|
||||
$data['images'][] = $tmp;
|
||||
$data['dirs'] = $dirs;
|
||||
}
|
||||
Template::view('tpl/gallery.html', $data);
|
||||
} else {
|
||||
|
|
|
@ -16,6 +16,13 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
{% foreach($dirs as $d): %}
|
||||
<div class="multi-image">
|
||||
<a href="index.php?d={{ $d }}&s=1&gs={{ $slice }}&p=1">
|
||||
<img src="./img/folder.png" alt="{{ $d }}"/>
|
||||
</a>
|
||||
</div>
|
||||
{% endforeach %}
|
||||
{% foreach($images as $image): %}
|
||||
<div class="multi-image">
|
||||
<a href="index.php?d={{ $dir }}&s=1&gs={{ $slice }}&p={{ $image['i'] }}{{ $filter }}">
|
||||
|
|
Loading…
Reference in a new issue