You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Benjamin Lorenz <be...@kapowtech.com> on 2010/11/15 16:59:51 UTC
NonCachingImage for CSS?
Hello,
I am including dynamic images into my webapp, using code like this:
add(new NonCachingImage("image", new AbstractReadOnlyModel() {
@Override
public Object getObject() {
return new ImageResource(verify.getImage(), "jpg");
}
}));
Now, I also have a background image, referenced from a .css file, which I want to be served dynamically. (How) can I do it?
I was thinking of writing my own image servlet that gets referenced in the css, like:
#welcomeMessage a {
background: url('/servlet/images/welcome') left top no-repeat;
display: block;
...
instead of
#welcomeMessage a {
background: url('../images/home_willkommen.jpg') left top no-repeat;
display: block;
...
But it would be interesting if there's also a wicket way of doing it.
Thanks!
Benjamin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: NonCachingImage for CSS?
Posted by Erik van Oosten <e....@grons.nl>.
Images referred to from css are resolved relative to the css file. So,
just put the images next to the css file and use no path in the image url:
background: url('home_willkommen.jpg') left top no-repeat;
Regards,
Erik.
Op 15-11-10 16:59, Benjamin Lorenz schreef:
> Hello,
>
> I am including dynamic images into my webapp, using code like this:
>
> add(new NonCachingImage("image", new AbstractReadOnlyModel() {
>
> @Override
> public Object getObject() {
> return new ImageResource(verify.getImage(), "jpg");
> }
> }));
>
> Now, I also have a background image, referenced from a .css file, which I want to be served dynamically. (How) can I do it?
>
> I was thinking of writing my own image servlet that gets referenced in the css, like:
>
> #welcomeMessage a {
> background: url('/servlet/images/welcome') left top no-repeat;
> display: block;
> ...
>
> instead of
>
> #welcomeMessage a {
> background: url('../images/home_willkommen.jpg') left top no-repeat;
> display: block;
> ...
>
> But it would be interesting if there's also a wicket way of doing it.
>
>
> Thanks!
>
> Benjamin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org