-
Notifications
You must be signed in to change notification settings - Fork 0
/
browse.html
123 lines (108 loc) · 4.27 KB
/
browse.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
// ----- begin edit -----
$title = 'Browse Images';
// ----- end edit -----
require('php/common.php');
require_once('php/custom.php');
require_once('php/search.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title><?php echo $title; ?></title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<?php echo $title; ?>">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="styles/style.css" />
<style>
div.title { display: block; color: #000080; }
.caption { display: block; }
.countselector {
width: 90px;
margin-bottom: 0.2em;
padding: 0;
float: right;
/*border: 1px dotted gray;*/
}
.list-group-item { padding: 0; } /* tighten list of "number of images" selection */
.list-group-item.active {
color: white !important;
background-color: #337ab7;
}
.list-group-item.active a { color: white; }
</style>
</head>
<body class="text-center">
<div class="jumbotron">
<h1>
<a href="http://nestedkeywords.com/">
Lightroom-nested-keywords
</a>
</h1>
</div>
<?php showNavBar(); ?>
<div class="row">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li>You are here: <a href="/index.html">Home</a></li>
<li><a href="/index.html">Photo Gallery</a></li>
<li aria-current="page"><?php echo $title; ?></li>
</ol>
</nav>
</div>
<?php
// Read our XML image database here, so we know how many images are available
require_once('php/image-database.php'); // for readImageDatabase()
$imglist = readImageDatabase( $imageDatabaseBasename );
$total_photo_library_size = count($imglist);
if (empty($total_photo_library_size)) {
showError("Internal error: No images are available in spite your really quite reasonable expectations. Contact the webmaster.", __FILE__, __LINE__);
}
?>
<div class="countselector">
<ul class="listgroup">
<?php
// Offer choice of how many images to display
// Note: this comes from URL parameters
$allowed_counts = array(25, 100, 500, 1000);
$random_image_count = getCleanGET('count', $allowed_counts[0]); // default to lowest number
$random_image_count = min($random_image_count, $total_photo_library_size);
//echo "<!-- random_image_count = $random_image_count -->".PHP_EOL; // debug
// Display box to select number of images shown
foreach ($allowed_counts as $count) {
$active = ($count == $random_image_count) ? ' active' : '';
echo "$indent <li class=\"list-group-item$active\"><a href=\"?count=$count\">$count</a></li>".PHP_EOL;
}
?>
</ul>
</div>
<!-- main content -->
<div class="container-fluid bg-3 text-left">
<div class="row">
<h1 id="header-text">
<?php echo $title; ?> <span class="glyphicon glyphicon-picture"></span>
</h1>
<p>Shown below are
<?php echo $random_image_count; ?> random images
out of <?php echo number_format($total_photo_library_size); ?>.
Refresh this page for new random images. Enjoy!</p>
</div><!-- end .row -->
<div class="row text-center">
<?php
// randomize images and show the first few
//echo '<pre>BEFORE: $imglist = '; var_dump($imglist); echo '</pre>'.PHP_EOL; // debug
$randomImageList = shuffle_with_keys($imglist, $random_image_count);
//echo "<br/><pre>AFTER: $randomImageList() for $random_image_count items = "; var_dump($randomImageList); echo '</pre>'.PHP_EOL; // debug
showSearchResultThumbnails($randomImageList, $indent);
?>
</div><!-- end .row -->
</div>
<footer class="container-fluid text-center">
<?php showFooter(); ?>
</footer>
</body>
</html>