|
Date: 1/22/2008 12:02 pm · Subject: Random Image in Stylesheet · Rating: 4
I have to admit i'm doing alot at once right now so I apologize if there is a simple answer to this question that I'm just not seeing. Is there some way to generate a random image URL for a CSS class? I'm developing a template and I want it to have a banner that can be customized by our content managers to do one of three things: - Leave as is (randomly include default images in banner from a pre-existing directory via css)
- Customize (upload custom images to a pre-determined directory to be included via css)
- Custom Randomize (upload multiple images to a pre-determined directory to be included via css)
The way it works is that we have a PHP script that collects the user preferences. If the user has images in a preset directory they can choose to use their images in place of the defaults and upon choosing to use custom images they can choose to make it random or static. The problem is that the template needs to be a flexible layout. So, the images need to be set as backgrounds for a given DIV. Which in turn means they need to be set via a css declaration. As it stands now I have a default stylesheet that sets a static banner image and I'm using an inline stylesheet declaration to override the banner class if they choose a custom image. That much is easy enough, however, getting those images randomly requires 'RandomAssetProxy' which returns an image tag not a URL. So, to state the problem simply; I need a way to pull a random asset's URL into a CSS class. Any advice? -Nate
--- (Edited on 1/22/2008 12:02 pm [GMT-0600] by philadev) ---
|