Inital implementation of image listing

This commit is contained in:
2026-01-05 10:49:00 +01:00
parent fe8d0bbffb
commit 9a067eca16
5 changed files with 390 additions and 128 deletions

View File

@@ -38,6 +38,40 @@ class Output
}
}
/**
* Render a thumbnail gallery (XHTML only).
*
* Expects a flat list of file items in $this->files.
* Clicking a thumbnail opens the original image.
*
* @param array $params
* @return void
*/
public function renderAsGallery($params)
{
if (!($this->renderer instanceof \Doku_Renderer_xhtml)) {
$params['style'] = 'list';
$this->renderAsList($params);
return;
}
/** @var \Doku_Renderer_xhtml $renderer */
$renderer = $this->renderer;
$renderer->doc .= '<div class="filetools-plugin filetools-gallery">';
foreach ($this->files as $item) {
$url = $this->itemWebUrl($item, !empty($params['randlinks']));
$safeUrl = hsc($url);
$label = hsc($item['name']);
$renderer->doc .= '<a href="' . $safeUrl . '" class="media" title="' . $label . '">';
$renderer->doc .= '<img src="' . $safeUrl . '" alt="' . $label . '" width="150" loading="lazy" />';
$renderer->doc .= '</a>';
}
$renderer->doc .= '</div>';
}
/**
* Renders the files as a table, including details if configured that way.
*