You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jun Tsai <ju...@gmail.com> on 2009/09/21 02:36:30 UTC

How to display Blob byte array image?

hi,  I had stored my image to database using byte array.How to display it? I
couldn't find any image component.

thanks

-- 
regards,
Jun Tsai

Re: How to display Blob byte array image?

Posted by Albert Tumanov <al...@gmail.com>.
Great example.

Can anybody add this to Tapestry5HowToStreamAnExistingBinaryFile please ?



On Mon, Sep 21, 2009 at 3:20 AM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> Em Sun, 20 Sep 2009 21:49:49 -0300, Jun Tsai <ju...@gmail.com> escreveu:
>
>> Thank your quick reply.I had seen it.But How to code image element in .tml
>> file?
>
> If implemented as a page with onActivate() return StreamResponse, I use the
> following code:
>
> @Inject
> private PageRenderLinkSource pageRenderLinkSource;
>
> public Link getImageLink() {
>        return
> pageRenderLinkSource.createPageRenderLinkWithContext(Index.class, context);
> }
>
> where context is the activation context you use to know which image is to be
> streamed (i.e. image id).
>
> <img src="${imageLInk}"/>
>
> --
> Thiago H. de Paula Figueiredo
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> 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


Re: How to display Blob byte array image?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Sun, 20 Sep 2009 21:49:49 -0300, Jun Tsai <ju...@gmail.com> escreveu:

> Thank your quick reply.I had seen it.But How to code image element in  
> .tml file?

If implemented as a page with onActivate() return StreamResponse, I use  
the following code:

@Inject
private PageRenderLinkSource pageRenderLinkSource;

public Link getImageLink() {
	return pageRenderLinkSource.createPageRenderLinkWithContext(Index.class,  
context);
}

where context is the activation context you use to know which image is to  
be streamed (i.e. image id).

<img src="${imageLInk}"/>

-- 
Thiago H. de Paula Figueiredo
http://www.arsmachina.com.br/thiago

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


Re: How to display Blob byte array image?

Posted by DH <ni...@gmail.com>.
Maybe this is feasible: Create an event link and get the url, put the url to the <img src and return the stream response in the event handler.

DH
http://www.gaonline.com.cn

----- Original Message ----- 
From: "Jun Tsai" 
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Monday, September 21, 2009 8:49 AM
Subject: Re: How to display Blob byte array image?


> Thank your quick reply.I had seen it.But How to code image element in .tml
> file?
> 
> 2009/9/21 Thiago H. de Paula Figueiredo <th...@gmail.com>
> 
>> Em Sun, 20 Sep 2009 21:36:30 -0300, Jun Tsai <ju...@gmail.com>
>> escreveu:
>>
>>  hi,  I had stored my image to database using byte array.How to display it?
>>> I couldn't find any image component.
>>>
>>
>> In any event handler method, return a StreamResponse. One example: the
>> ImagePage and JPEGAttachment classes in
>> http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java consultant, developer, and instructor
>> http://www.arsmachina.com.br/thiago
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> -- 
> regards,
> Jun Tsai
>

Re: How to display Blob byte array image?

Posted by Jun Tsai <ju...@gmail.com>.
Thank your quick reply.I had seen it.But How to code image element in .tml
file?

2009/9/21 Thiago H. de Paula Figueiredo <th...@gmail.com>

> Em Sun, 20 Sep 2009 21:36:30 -0300, Jun Tsai <ju...@gmail.com>
> escreveu:
>
>  hi,  I had stored my image to database using byte array.How to display it?
>> I couldn't find any image component.
>>
>
> In any event handler method, return a StreamResponse. One example: the
> ImagePage and JPEGAttachment classes in
> http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
regards,
Jun Tsai

Re: How to display Blob byte array image?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Sun, 20 Sep 2009 21:36:30 -0300, Jun Tsai <ju...@gmail.com> escreveu:

> hi,  I had stored my image to database using byte array.How to display  
> it? I couldn't find any image component.

In any event handler method, return a StreamResponse. One example: the  
ImagePage and JPEGAttachment classes in  
http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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