Hello all,
I have an action to retrieve an image from a database BLOB field and
display it.
It works great.
However I wanted to resize the image proportionaly. Hence I think on
writing a second action, that would
call the first in order to retrieve the image. Then, would work on this
image to resize it and send it over to the browser.
Or maybe change the original action to do that to save the overhead.
I would like to know how to accomplish image resizing in Java. The image
can be a JPG, a GIF or a BMP. Hence I need to handle
all these situations depending on the Content/Type that is stored in the
database along with the BLOB.
When you retrieve a BLOB you write it to a ByteArrayOutputStream. Then
you just set the response.SetContentType , setContentLength and send the
ByteArrayOutputStream by calling the method .toByteArray() and .flush.
I have two options, I can change the original Action to accept a request
attribute to determine the width or height. Then I can work the image
and spit it out. The way I think about it is that I would need to,
somehow, create an Image object by taking the ByteArray from the
ByteArrayOutputStream. This image object could be a JPG, GIF or BMP. I
would determine which one to use based on the Content/Type of the
database. They this object could be resized and return a byteArray that
I could send to the browser.
I guess I have most of it done but I would like advise on how to:
1) Construct a JPG, GIF or BMP object with the ByteArray
2) Resize this object and produce a resided ByteArray so that I can send
it to the browser.
Any ideas on how to perform that?
Any documentation regarding this that I could browse?
Thanks,
C.F.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]