How to display Blob byte array image?

View: New views
6 Messages — Rating Filter:   Alert me  

How to display Blob byte array image?

by james cai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

by Thiago H. de Paula Figueiredo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Em Sun, 20 Sep 2009 21:36:30 -0300, Jun Tsai <jun.tsai@...> 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@...
For additional commands, e-mail: users-help@...


Re: How to display Blob byte array image?

by james cai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <thiagohp@...>

> Em Sun, 20 Sep 2009 21:36:30 -0300, Jun Tsai <jun.tsai@...>
> 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@...
> For additional commands, e-mail: users-help@...
>
>


--
regards,
Jun Tsai

Re: How to display Blob byte array image?

by Thiago H. de Paula Figueiredo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Em Sun, 20 Sep 2009 21:49:49 -0300, Jun Tsai <jun.tsai@...> 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@...
For additional commands, e-mail: users-help@...


Re: How to display Blob byte array image?

by ningdh-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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" <users@...>
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 <thiagohp@...>
>
>> Em Sun, 20 Sep 2009 21:36:30 -0300, Jun Tsai <jun.tsai@...>
>> 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@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>
> --
> regards,
> Jun Tsai
>

Re: How to display Blob byte array image?

by Albert Tumanov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Great example.

Can anybody add this to Tapestry5HowToStreamAnExistingBinaryFile please ?



On Mon, Sep 21, 2009 at 3:20 AM, Thiago H. de Paula Figueiredo
<thiagohp@...> wrote:

> Em Sun, 20 Sep 2009 21:49:49 -0300, Jun Tsai <jun.tsai@...> 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@...
> For additional commands, e-mail: users-help@...
>
>

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