obsidian-web/templates/content.php
Curle dbabeeefb9
Current working tree.
Has some issues to be worked out.
2020-09-14 21:28:00 +01:00

90 lines
2.1 KiB
PHP

<div id="content">
<?php
/**
* We enumerate the folders and files, as a form of basic indexing.
*/
$categories = listFolders( $imagesFolder );
//echo "<span> cats: ". var_dump($categories) ."</span";
$pictures = listFiles( $imagesFolder );
//echo "<span> pics: ". var_dump($pictures) . "</span";
if ( count( $categories ) > 0 ) {
echo "<div id='categories'>\n";
foreach ( $categories as $category ) {
if (file_exists( $category."/.gridhide") ) {
continue;
}
$file = absoluteToRelative( $category, $imagesFolder );
$name = tidyName( $category );
$createFile = false;
foreach( $newImages as $entry ) {
$path = realpath( $category );
if( isInFolder( $path, $entry ) ) {
$createFile = true;
break;
}
}
$image = addslashes( absoluteToRelative( listFiles( $category, true, true), $imagesFolder ));
echo "<div class='folder' stlye='";
echo "background: url('?thumb=$image') no-repeat center center;";
echo "-webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;'>";
if( $createFile ) { ?>
<div class="new"></div>
<?php }
echo "<div class='title'> <a href='?category=$file'> $name </a> </div> </div>";
}?>
</div>
<?php
}
if( count( $pictures ) > 0 ) { ?>
<div id="thumbs">
<?php
foreach ($pictures as $file ) {
$picture = absoluteToRelative( $file, $imagesFolder);
$name = tidyName( $file );
$createFile = "";
foreach( $new as $entry ) {
$path = getPath( $file );
if( isInFolder( $path, $entry ) ) {
$createFile = "new";
break;
}
}
echo "<div class='thumb $createFile'> <a href='?image=$picture'> <img src='?thumb=$picture'> </a> </div>";
}?>
</div>
<?php
} ?>
</div>
<div id="viewer">
<div id="lightbox">
</div>
</div>
</div id="loading">
Loading.
</div>