User:Aristeas/Random front-page image
Documentation
[edit]This subpage template just creates a complete [[File:...]]
element with a (pseudo-)random front-page image for my user page.
The random image technique used here was inspired by Poco a poco’s random sample photo, thank you! (The latter is based in turn on the random image by former user Biopics.) Another idea (for a limited selection) would be to use {{CURRENTDAY}}
, delivering numbers 1 to 31.
Argument(s)/Parameter(s)
[edit]- Desired max. width and max. height of the image, specified in the special
(maxwidth)x(maxheight)px
format, e.g.640x640px
. As usual the Mediawiki software will size the image to whichever value would make it smaller (cf. the documentation).
Caveat
[edit]The documentation for the {{Rand}} template clearly states that e.g. {{Rand|33}}
delivers integers from the range [0, 33[, i.e. only numbers < 33. This is also how Poco a poco’s random sample photo uses the template. But Biopics’, Hubertl’s and Stepro’s implementations seem to understand the result as a number from [0, n], i.e. including n. And from time to time my implementation (assuming [0, n[) failed and delivered just an empty string for the image name. But this happens even when I assume [0, n], “to be on the save side”, therefore this cannot be the reason of the failure.
See also
[edit]There is a new alternative implementation.