- foreach ($imgs as $img) {
- if ($img == "$rootdir/index.jpg") continue;
- if (!is_link($img)) continue;
- print '<li>'.showthumb($img);
+ foreach ($imgs as $path) {
+ if ($path == "$rootdir/index.jpg") {
+ # cover image of current album
+ $Page->image = "/$path";
+ continue;
+ }
+ if (!is_link($path)) continue;
+
+ // assume all album entries are symlinks to archive originals
+ $target = preg_replace('{^(\.\./)*}', '', readlink($path));
+ $thumb = 'thumb/262/' . $target;
+
+ @list ($order, $size, $title) = explode(':', pathinfo($path, PATHINFO_FILENAME), 3);
+ $imgtag = 'img src="/'.$thumb.'"';
+ if ($title) {
+ $imgtag .= ' title="'.htmlspecialchars(urldecode($title)).'"';
+ }
+ if ($size) {
+ $imgtag .= ' data-size="'.$size.'"';
+ }
+
+ print '<li>';
+ printf('<a href="/%s"><%s /></a>'."\n", $target, $imgtag);