You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Emmanouil Batsis <Em...@eurodyn.com> on 2006/08/01 13:37:53 UTC

taglib for locale-dependent logic to images?

Suppose i have an images folder in my webapp with subfolders 
corresponding to locales:

+ WEB-INF
+ jsps
+ images
   + default
      + myImage.png
   + fr
      + myImage.png
   + el
      + myImage.png

i'd like to do something like

<foo:img imageFolder="images" image="myImage.png" />

to render the image whose parent folder matches the user's locale if 
that folder does have a file named "myImage.png" or to try and get the 
image from the default locale/folder otherwise.

Is there any taglib like that available anywhere?

Thanks in advance,

Manos
   


 




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: taglib for locale-dependent logic to images?

Posted by Emmanouil Batsis <Em...@eurodyn.com>.
I decided to do my own thinking and i believe the best way to go would 
be to make a simple action to solve this (and use normal img tags as 
well). The action will

* intercept all URLs starting with /images
* check the availability of the file stream prefixing the requested URL 
with the locale and
* serve that or
* FW to the originally requested image URL if no locale dependent img is 
found.

I don't even think a taglib makes sense anymore ;-)

Cheers,

Manos


Emmanouil Batsis wrote:

>
> Suppose i have an images folder in my webapp with subfolders 
> corresponding to locales:
>
> + WEB-INF
> + jsps
> + images
>   + default
>      + myImage.png
>   + fr
>      + myImage.png
>   + el
>      + myImage.png
>
> i'd like to do something like
>
> <foo:img imageFolder="images" image="myImage.png" />
>
> to render the image whose parent folder matches the user's locale if 
> that folder does have a file named "myImage.png" or to try and get the 
> image from the default locale/folder otherwise.
>
> Is there any taglib like that available anywhere?
>
> Thanks in advance,
>
> Manos
>  
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: taglib for locale-dependent logic to images?

Posted by Niall Pemberton <ni...@gmail.com>.
On 8/1/06, Emmanouil Batsis <Em...@eurodyn.com> wrote:
>
> Suppose i have an images folder in my webapp with subfolders
> corresponding to locales:
>
> + WEB-INF
> + jsps
> + images
>    + default
>       + myImage.png
>    + fr
>       + myImage.png
>    + el
>       + myImage.png
>
> i'd like to do something like
>
> <foo:img imageFolder="images" image="myImage.png" />
>
> to render the image whose parent folder matches the user's locale if
> that folder does have a file named "myImage.png" or to try and get the
> image from the default locale/folder otherwise.
>
> Is there any taglib like that available anywhere?

You can do this with the current <html:img> tag - use either the
"pageKey" or "srcKey" attributes:

http://struts.apache.org/1.2.x/userGuide/struts-html.html#img

Niall


> Thanks in advance,
>
> Manos

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org