Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay BLOB (image) through JSP
    primarykey
    data
    text
    <p>I have a code to show a chart o employees.</p> <p>The data (name, phone, photo etc) are stored in SQLServer and displayed through JSP. Showing the data is ok, except the image .jpg (stored in IMAGE=BLOB column).</p> <p>By the way, I've already got the image displayed (see code below), but I dont't know how to put it in the area defined in a .css (see code below, too), since the image got through the resultSet is loaded in the whole page in the browser.</p> <p>Does anyone knows how can I 'frame' the image ?</p> <pre><code>&lt;% Connection con = FactoryConnection_SQL_SERVER.getConnection("empCHART"); Statement stSuper = con.createStatement(); Statement stSetor = con.createStatement(); Blob image = null; byte[] imgData = null; ResultSet rsSuper = stSuper.executeQuery("SELECT * FROM funChart WHERE dept = 'myDept'"); if (rsSuper.next()) { image = rsSuper.getBlob(12); imgData = image.getBytes(1, (int) image.length()); response.setContentType("image/gif"); OutputStream o = response.getOutputStream(); //o.write(imgData); // even here we got the same as below. //o.flush(); //o.close(); --[...] &lt;table style="margin: 0px; margin-top: 15px;"&gt; &lt;tr&gt; &lt;td id="photo"&gt; &lt;img title="&lt;%=rsSuper.getString("empName").trim()%&gt;" src="&lt;%= o.wite(imageData); o.flush(); o.close(); %&gt;" /&gt; &lt;/td&gt; &lt;/td&gt; &lt;td id="empData"&gt; &lt;h3&gt;&lt;%=rsSuper.getString("empName")%&gt;&lt;/h3&gt; &lt;p&gt;&lt;%=rsSuper.getString("Position")%&gt;&lt;/p&gt; &lt;p&gt;Id:&lt;br/&gt;&lt;%=rsSuper.getString("id")%&gt;&lt;/p&gt; &lt;p&gt;Phone:&lt;br/&gt;&lt;%=rsSuper.getString("Phone")%&gt;&lt;/p&gt; &lt;p&gt;E-Mail:&lt;br/&gt;&lt;%=rsSuper.getString("Email")%&gt;&lt;/p&gt; &lt;/td&gt; &lt;/table&gt; </code></pre> <p>And here is the fragment supposed to frame the image:</p> <pre><code>#photo { padding: 0px; vertical-align: middle; text-align: center; width: 170px; height: 220px; } </code></pre> <p>Thanks in advance !</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload