You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Neville <ja...@babcockbrown.com> on 2005/08/19 15:35:12 UTC

[OT] Re: Resizing output image from a Struts Action

CF,

This probably isn't the best list to be asking these types of questions, 
but seeing as you wrote such a long mail, i figured a pointer is at 
least warranted ;)

I don't think you can resize an image directly from a ByteArray, but 
someone here will probably prove me wrong.
We need similar functionality in one of our apps, but we also store the 
resized preview back to the DB for later use.
We can also pass the width/height in the form, but we make sure it fits 
a max size rect.

1. Write the image to a File from the ByteArrayOutputStream.
2. Use Java Advanced Imaging to resize it.
3. Use another ByteArrayOutputStream to return it to the browser, 
setting content type etc, just as you did from the BLOB.

Theres more about this in the mailing list archives, and sample code on 
the Sun JAI site.

Regards,
James.

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