You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Hbiloo <wa...@gmail.com> on 2009/06/29 02:03:42 UTC

How to get the URL of a dynamically generated image?

Hi all,

I've a image which is dynamically generated. Now I want to use URL of
this image in a CSS file as a background of a div.
Is there a way to do that?

Regards,
Hbiloo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to get the URL of a dynamically generated image?

Posted by Martin Grigorov <mc...@e-card.bg>.
See (Buffered)DynamicImageResource. 
Pass this resource to RequestCycle.urlFor(), this will return a context
relative path to the resource.
To pass that path to the .css you could use
org.apache.wicket.util.template.CssTemplate

Note: The path to the image in the .css must be relative to the .css
file itself! So most probably you'll have to manipulate the path
returned by urlFor().


El lun, 29-06-2009 a las 02:03 +0200, Hbiloo escribió:
> Hi all,
> 
> I've a image which is dynamically generated. Now I want to use URL of
> this image in a CSS file as a background of a div.
> Is there a way to do that?
> 
> Regards,
> Hbiloo
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to get the URL of a dynamically generated image?

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Probably best to mount the resource in your app init method so that it
has a static path and then use that in your CSS.

That, or you can use the text templating to inject the dynamic URL
into templated CSS.  Then you could just use urlFor to get the URL.

--
Jeremy Thomerson
http://www.wickettraining.com




On Sun, Jun 28, 2009 at 7:03 PM, Hbiloo<wa...@gmail.com> wrote:
> Hi all,
>
> I've a image which is dynamically generated. Now I want to use URL of
> this image in a CSS file as a background of a div.
> Is there a way to do that?
>
> Regards,
> Hbiloo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org