Template:ImageGrid: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
< | <style> | ||
{{# | .imagegrid-flex { | ||
{{#if: {{{ | display: flex; | ||
{{# | flex-wrap: wrap; | ||
gap: 0.5em; | |||
justify-content: center; | |||
} | |||
.imagegrid-flex img, .imagegrid-flex .mw-file { | |||
max-width: 200px; | |||
height: auto; | |||
} | |||
</style> | |||
<div class="imagegrid-flex"> | |||
{{#foreach: {{{images|}}} |- | |||
{{#if: {{{this|}}} | | |||
<!-- If it looks like a plain filename, use File: prefix; otherwise assume it's a full URL --> | |||
{{#ifeq: {{#strpos: {{{this}}} | https:// }} | -1 | | |||
<!-- no URL substring found → treat as wiki image name --> | |||
[[File:{{{this}}}|frameless]] | |||
| | |||
<!-- contains "https://" → embed via <img> --> | |||
<img src="{{{this}}}" alt="" /> | |||
}} | |||
}} | |||
}} | |||
</div> | </div> | ||
</includeonly> | </includeonly> | ||