You guys would not believe how many messages and emails I get from people asking how I do the random header background I have on 8WayRun.Com. Well as it turns out, this is actually I script I wrote several years ago, and have been reusing since vBulletin3, vBulletin4 and now XenForo.
- Will search for matching nodes/wikis/portal when displaying images
- Will search for matching user preferences when displaying images
- Full support for the following image types: JPG, GIF and PNG
- upload the entire contents of the attached zip to your XenForo root
- Anywhere you want to use this, instead of a link to an image, link to the following:
- You CAN NOT use this system in the built in XenForo CSS system. XenForo aggressively caches it's CSS files, so the whole semblance of "dynamic" or "random" is just not possible. If you want to use this, such as I have on 8WayRun.Com, you must put the property directly into the element in your templates.
- This system has a hierarchy of how it finds images to place. NODE > USER > RANDOM
The first thing it will check is for "node". It will take the value in this field and try to find an image matching the value from the folder /styles/header/nodes/; it will first check for a PNG, then a JPG, and finally a GIF. Nodes currently can be "node-#", "wiki-#" or "portal".
If it can't find a valid node image, it will then search for "user". The user operation pulls the images from the /styles/header/users/ folder. In order to use this feature, XenForo 1.1 is required. You must create a new custom user field ID called "header" and add preferences options with the value being the name of your image (not including the extension).
If after all that, it still can't find a valid image, either from nodes or user customized, it will instead search the /styles/header/random/ and find an image at random to display.