title: java.lang.IllegalArgumentException: Width (0) and height (0) must be non-zero in JAVA NETBEANS
body: <p>I have been working on a project. I have a form where user details would be entered alongside their profile photo being uploaded.</p>
  
  <p>But im stuck with this error while trying to retrieve user profile photo when I search their records from the database using <code>txt_searchKeyReleased</code> method. </p>
  
  <p>I get the error 
  <code>java.lang.IllegalArgumentException: Width (0) and height (0) must be non-zero</code></p>
  
  <p>which occurs at line where im pulling the image from the DB as below</p>
  
  <p><code>byte[] image=rs.getBytes("Image");
                  ImageIcon imageicon=new ImageIcon(new ImageIcon(image).getImage().getScaledInstance(lbl_image.getWidth(),lbl_image.getHeight(),Image.SCALE_DEFAULT));
                  lbl_image.setIcon(imageicon);</code></p>
  
  <p>I am storing the image directly to the database as a <code>LONGBLOB</code>. I would appreciate a correction so as to be able to retrieve the users profile photo.
  And also to be able to store users profile photo into a folder within my project and store its path along with their details in the database.</p>