commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grogan <mgro...@mobilegolfers.net>
Subject [fileupload] Maximum size for upload?
Date Thu, 28 Jul 2005 06:49:12 GMT
Hi all,
Some time ago, I posted a question (and subsequently a code solution) 
relating to JPEG scaling. This issue has now been resolved, and I am 
working on storing images uploaded to a mySQL database as BLOBs 
(MEDIUMBLOB).
It seems that when the image size is > 65535 bytes, the bottom of the 
image is chopped off, and I am left with an image that is exactly 65535 
bytes.
If anyone has any ideas on why this might be happening, and how I can 
resolve it, I would be grateful.
Many thanks,
Martin

Some of the code I'm using is here...
      
                    ..............................
                    BufferedImage origImage = new 
BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
                     java.awt.Graphics2D graphics2D2 = 
origImage.createGraphics();                                            
                    
graphics2D2.setRenderingHint(java.awt.RenderingHints.KEY_INTERPOLATION,java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR);
                   graphics2D2.drawImage(image, 0, 0, imageWidth, 
imageHeight, null);
                    // get output stream from image                  
                    ByteArrayOutputStream os2= new ByteArrayOutputStream();
                    ImageIO.write(origImage,"jpeg",os2);                  
                    byte[] orig= os2.toByteArray();
                    // setup input stream for blob                   
                    ByteArrayInputStream inStream2= new 
ByteArrayInputStream(orig);
                    try
                    {
                        Class.forName( "com.mysql.jdbc.Driver");
                        Connection 
connection=DriverManager.getConnection("jdbc:mysql://localhost/gallery","gallery","gallery");
   
       
                        String query="INSERT INTO img (name, pic) VALUES 
('";                       
                        query=query+"picture',";
                        query=query+"?"+")";
                        PreparedStatement statement = 
connection.prepareStatement(query);                        
                      
                        
//statement.setBinaryStream(1,inStream2,orig.length);                        
// doesn't seem to work either
                        statement.setBytes(1,orig);
                        ....................

---------------------------------------------------------------------
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