You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@gunnsoft.com.au> on 2007/11/08 04:31:39 UTC

asset from byte array or stream

Hi all, I need a little help (4.1)

I have an object with a byte array which contains data for a small 
image. I'm printing a summary of this object in a page and need to 
display the image as well.

Is there a way I can create an asset and use it with the Image componet 
to display the image? something like:

<asset name="imageAsset" stream="ognl:page.imageStream"/>
-or-
<asset name="imageAsset" data="ognl:page.imageBytes"/>
...
<img jwcid="@Image" image="asset:imageAsset"/>

Any suggestions?

Thanks, Paul.



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


Re: asset from byte array or stream

Posted by Ulrich Stärk <ul...@spielviel.de>.
An asset is nothing more than a representation of an URL to some kind of
image or style sheet. When asked to return it's content it will employ the
asset service to do so.
You should create an engine service that displays the image data with
content-type image/* and call it from your page (much like the asset
service used to deliver the asset with a given path). I wouldn't pass it
the raw image data though but an object identifier which the service then
uses to retrieve the object.
Have a look here
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-archetype/src/main/resources/archetype-resources/src/main/java/services/RoundedCornerService.java?view=markup
for an example of a service that generates an image and writes it to the
output stream.

Cheers,

Uli

On Do, 8.11.2007, 04:31, Paul Stanton sagte:
> Hi all, I need a little help (4.1)
>
> I have an object with a byte array which contains data for a small
> image. I'm printing a summary of this object in a page and need to
> display the image as well.
>
> Is there a way I can create an asset and use it with the Image componet
> to display the image? something like:
>
> <asset name="imageAsset" stream="ognl:page.imageStream"/>
> -or-
> <asset name="imageAsset" data="ognl:page.imageBytes"/>
> ...
> <img jwcid="@Image" image="asset:imageAsset"/>
>
> Any suggestions?
>
> Thanks, Paul.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



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