Click here to register.
      
PBWG Banner


     Web Design, Templates, and Themes > Random Image in Stylesheet

Random Image in Stylesheet

User philadev
Date 1/22/2008 12:02 pm
Views 647
Rating 4    Rate [
|
]
Previous · Next
User Message
philadev

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:

  1. Leave as is (randomly include default images in banner from a pre-existing directory via css)
  2. Customize (upload custom images to a pre-determined directory to be included via css)
  3. 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) ---



Back to Top
Rate [
|
]
 
 
preaction
Change the Image template so that the RandomAssetProxy returns just the URL?

--- (Edited on 1/22/2008 12:48 pm [GMT-0600] by preaction) ---



Back to Top
Rate [
|
]
 
 

Re: News Addon? by knowmad - Thu @ 06:04pm

Re: News Addon? by bepo - Thu @ 08:54am

Re: News Addon? by bepo - Thu @ 03:35am

Smoketest For nightly_2008-07-03 by Visitor - Thu @ 01:37am

Thingy Reporting (pt 2) by knowmad - Wed @ 05:37pm

Re: News Addon? by knowmad - Wed @ 05:12pm

spell checker and tinymce by elnino - Wed @ 04:50pm

Re: WebGUI works on perl 5.10 by knowmad - Wed @ 04:41pm

Re: how the cost installing WebGUI ?? by baylink - Wed @ 12:19pm

Re: News Addon? by bepo - Wed @ 07:38am

Re: News Addon? by bepo - Wed @ 03:38am

Re: External Links by bepo - Wed @ 03:30am

Smoketest For nightly_2008-07-02 by Visitor - Wed @ 01:36am