Inital implementation of image listing
This commit is contained in:
34
Output.php
34
Output.php
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user