mal2html.ui.links.img
Parameters
- $node
A links element to link from.
- $thumbs
A list of candidate uix:thumb elements.
- $role
A link role, used to select the appropriate thumbnail.
- $width
The width to fit thumbnails into.
- $height
The height to fit thumbnails into.
This template selects the best-fit thumbnail from $thumbs, based on how well the aspect ratio and dimensions of each image matches the $width and $height parameters. It outputs an HTML img element for the best-fit thumbnail. It calls $mal2thml.ui.links.img.src to output the src attribute, and calls $mal2html.ui.links.img.attrs to output width and height attributes.
Before checking for a best-fit thumbnail on dimensions, this template first looks for uix:thumb elements with the type attribute set to "links". Within those, it looks for uix:thumb elements whose role attribute matches the $role parameter. This is similar to how link titles are selected.
If the $thumbs parameter is empty, this template attempts to use a default thumbnail provided by a uix:thumb child element of $node.
The $width and $height parameters can be computed automatically from the $node element.