title: Resizing a picture on a jsp page that's stored in a database
body: <p>I'm trying to set the size of a picture on a jsp page that i pull from a database.</p>
  
  <p>I can get the image ok but it's filling the whole page.</p>
  
  <p>Anyone know how to set the size of the picture</p>
  
  <p>Thanks</p>
  
  <p>Here's the code i have on my jsp:</p>
  
  <pre><code>&lt;%
  
  Blob image = null;  
  byte[] imgData = null;  
  Connection con;
  String url="jdbc:mysql://localhost:3306/comshopDatabase";
  String uName="root";
  String pwd="";
  Class.forName("com.mysql.jdbc.Driver").newInstance();
      con=DriverManager.getConnection(url,uName,pwd);
      String sql="Select image from images WHERE id = '1' ";
      PreparedStatement stmt=con.prepareStatement(sql);
  
      ResultSet resultset=stmt.executeQuery();
  while(resultset.next())
  {
  
      Blob bl = resultset.getBlob("image");
      byte[] pict = bl.getBytes(1,(int)bl.length());
      response.setContentType("image/jpg");
      OutputStream o = response.getOutputStream();
  
  
  
  %&gt;
  &lt;TABLE BORDER="1"&gt;
  &lt;TR&gt;
  &lt;TH&gt;picture&lt;/TH&gt;
  &lt;/TR&gt;
  &lt;TR&gt;
  
  
  &lt;td&gt;Image&lt;/td&gt;&lt;td&gt;&lt;%o.write(pict);%&gt;&lt;/td&gt;
      &lt;%o.flush();
      o.close();%&gt;
  
  &lt;TD&gt; &lt;%= resultset.getString(2) %&gt; &lt;/TD&gt;
  &lt;TD&gt;&lt;%= resultset.getString(3) %&gt;&lt;/TD&gt;
  &lt;/TR&gt;
  &lt;/TABLE&gt;
  &lt;BR&gt;
  &lt;%
  o.flush();
  o.close();
  }
  %&gt;
  </code></pre>