struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lowe <mark.l...@boxstuff.com>
Subject Re: not quite struts: handling Images
Date Tue, 27 Jul 2004 10:34:25 GMT
Not sure about the resize and save (3-4) but the rest i use for 
ensuring users dont upload any old sizes..


java.io.ByteArrayInputStream;
java.awt.image.BufferedImage;
javax.imageio.ImageIO;

byte[] image = form.getImage().getFileData();
ByteArrayInputStream  stream = new ByteArrayInputStream(image);
BufferedImage img = ImageIO.read(stream);

BufferedImage has getWidth and getHeight

Perhaps also better not to use getFileData on the formFile, and use the 
getInputStream method instead as its less heavy..

Mark

On 27 Jul 2004, at 10:28, ron1 wrote:

> Hi -
> after spending much time wondring through the JAI API I thought maybe 
> one of you guys can help me:
> I need a very simple:
> 1. upload-image (jpg/gif)
> 2. getProps (size, width)
> 3. resize
> 4. save JPG with custom compression.
> The upload is done via FormFile, so I have the InputStream - all the 
> rest via Java API - and I have no clue of where to get started :-(
> Cheers,
> Ron
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


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


Mime
View raw message