commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Grogan" <mgro...@mobilegolfers.net>
Subject Re: [FileUpload] Resizing JPEG before upload
Date Thu, 02 Jun 2005 10:37:35 GMT
Hi Stefan,
Thanks for your quick reply. I have tried to integrate the code on that 
site, but without much luck. I have the following fragment as an example. I 
must admint, my knowledge of AWT and SWING are not good.
if(contentType.equals("image/pjpeg"))
                {
                    File uploadedFile = new File("output.jpg");
                    ImageIcon myImageIcon = new ImageIcon(item.get());    // 
get byts in file item
                    myImageIcon = resizeImage( myImageIcon, 150, 100);    // 
i need to scale the image to max 150x100 pixels
                    //  need now to convert myImageIcon back to a JPEG of 
size 150x100, but don't know where to start with this.
                    // newitem should be a byte[] ? that has been re-encoded 
to JPEG?
                    try{
                        item.write(newitem);
                    }
                    catch(Exception e){out.println("Problem uploading 
file");}
                }
This is probably all wrong, and not the way to go about things, but I'm 
coding in the dark on this one.
Many thanks,
Martin 


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


Mime
View raw message