Click here to register.
      
IRC banner


     Discuss > Web Design, Templates, and Themes

Random Image in Stylesheet

User philadev
Date 1/22/2008 12:02 pm
Views 835
Rating 2    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 [
|
]
 
 

shows by JT - Mon @ 05:16pm

Glad to be here by titlandata - Mon @ 04:22pm

Re: Partner for Featu Document Repository by JT - Mon @ 04:21pm

User Registration and update page by aewhale - Mon @ 03:56pm

Re: Partner for Feature: Document Repository by sduensin - Mon @ 03:35pm

Re: Partner for Featu Document Repository by JT - Mon @ 03:26pm

Re: Glad to be here by sduensin - Mon @ 02:26pm

Re: Partner for Feature: Document Repository by sduensin - Mon @ 02:14pm

Re: is there a an audio/video gallery wobject? by fdillon - Mon @ 02:04pm

Re: Security on files ? by knowmad - Mon @ 01:55pm

Form not working. Help! by pvanthony - Mon @ 12:01pm

Security on files ? by dwittenberg - Mon @ 11:47am

Re: Partner for Feature: Document Repository by alphamega - Mon @ 11:08am