Display BLOB Image in a JSP page.

Hi, Is there any easy way to display a Image in the browser using a JSP and an Oracle BLOB. I would like any code examples that anyone can provide me. I would like as many ways to do this as possible.
Thanks Brian

You can do it in 2 ways:
1. Get the BLOB from the DB and then write it into the local harddisk where the Web Server is located and then give the path in the <IMG SRC> Tag.
2. In the JSP, when you specify a IMG Tag
<IMG SRC='FileDisplayServlet?hdImgName=new.gif'>
This SRC is pointing to a Servlet. The Servlet will read the Query String and then go hit the DB, get the BLOB Content and then convert into a byte array. Now the servlet will change its content type to image or gif. Then it will write the content in the out stream.
Hope this helps.
Thanks and regards,
Pazhanikanthan. P

Similar Messages

  • Problem with displaying BLOB images on JSP page using a servlet

    hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that servlet, that is http://localhost:8080/ImageServlet. It doesn't work when i try to use that servlet to display my image on my JSP page (my JSP page displays only a broken-image icon ) I tried several coding approaches with my servlet (used both Blob and BLOB objects), and they work just fine as long as i display images explicitly using only the servlet.
    Here's what i use : ORACLE 10g XE , Eclipse 3.1.2, Tomcat 5.5.16 , JDK 1.5
    here is one of my image servlet's working versions (the essential part of it) :
                   BLOB blob=null;
              rset=st.executeQuery("SELECT * FROM IMAGES WHERE ID=1");
              while (rset.next())
                   blob=((OracleResultSet)rset).getBLOB(2);
              response.reset();
              response.setContentType("image/jpeg");
              response.addHeader("Content-Disposition","filename=42.jpeg");
                    ServletOutputStream ostr=response.getOutputStream();
                   InputStream istr=blob.getBinaryStream(1L);
                    int size=blob.getBufferSize();
              int len=-1;
                    byte[] buff = new byte[size];
                         while ((len=istr.read( buff ))!=-1 ) {
                   ostr.write(buff,0,len);
             response.flushBuffer();
             ostr.close(); and my JSP page code :
    <img src="/ImageServlet" border="0"  > If you could just tell me what i'm doing wrong here , or if you could show me your own solutions to that problem , i would be very greatful ,cos i'm realy stuck here , and i'm rather pressed for time too. Hope someone can help.

    I turns out that it wasn't that big of a problem after all. All i had to do was to take the above code and place it into another JSP page instead of into a servlet like i did before. Then i just used that page as a source for my IMG tag in my first JSP. It works perfectly well. Why this doesn't work for servlets i still don't know, but it's not a problem form me anymore . Ofcourse if someone knows the answer , go ahead and write. I would still appriceatte it.
    here's the magic tag : <img src="ImageJSP.jsp" border="0"  > enjoy : )

  • Displaying Image on th JSP page

    Hello All,
    I am using following code to display the image on the JSP page in my iView
    <% String PublicURL = componentRequest.getPublicResourcePath()+ "/images/Image1.gif"  ; %>
    <hbj:image id="Logo" width="70" height="35" 
                               src="<%= PublicURL %>"
                               alt= "picture Ericsson.gif" />
    Am I missing anything. I am still not able to display the image.
    Regards,
    Sanjeev

    change
    componentRequest.getPublicResourcePath()
    to
    componentRequest.getWebResourcePath()

  • I want to display BLOB image in JSP Using  html tags IMG src=

    GoodAfternoon Sir/Madom
    I Have got the image from oracle database but want to display BLOB image using <IMG src="" > Html tags in JSP page . If it is possible than please give some ideas or
    Send me sample codes for display image.
    This code is ok and working no problem here Please send me code How to display using html tag from oracle in JSP page.
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="javax.swing.ImageIcon;" %>
          <%
            out.print("hiiiiiii") ;
                // declare a connection by using Connection interface
                Connection connection = null;
                /* Create string of connection url within specified format with machine
                   name, port number and database name. Here machine name id localhost
                   and database name is student. */
                String connectionURL = "jdbc:oracle:thin:@localhost:1521:orcl";
                /*declare a resultSet that works as a table resulted by execute a specified
                   sql query. */
                ResultSet rs = null;
                // Declare statement.
                PreparedStatement psmnt = null;
                  // declare InputStream object to store binary stream of given image.
                   InputStream sImage;
                try {
                    // Load JDBC driver "com.mysql.jdbc.Driver"
                    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
                        /* Create a connection by using getConnection() method that takes
                        parameters of string type connection url, user name and password to
                        connect to database. */
                    connection = DriverManager.getConnection(connectionURL, "scott", "root");
                        /* prepareStatement() is used for create statement object that is
                    used for sending sql statements to the specified database. */
                    psmnt = connection.prepareStatement("SELECT image FROM img WHERE id = ?");
                    psmnt.setString(1, "10");
                    rs = psmnt.executeQuery();
                    if(rs.next()) {
                          byte[] bytearray = new byte[1048576];
                          int size=0;
                          sImage = rs.getBinaryStream(1);
                        //response.reset();
                          response.setContentType("image/jpeg");
                          while((size=sImage.read(bytearray))!= -1 ){
                response.getOutputStream().write(bytearray,0,size);
                catch(Exception ex){
                        out.println("error :"+ex);
               finally {
                    // close all the connections.
                    rs.close();
                    psmnt.close();
                    connection.close();
         %>
         Thanks

    I have done exactly that in one of my applications.
    I have extracted the image from the database as a byte array, and displayed it using a servlet.
    Here is the method in the servlet which does the displaying:
    (since I'm writing one byte at a time, it's probably not terribly efficient but it works)
         private void sendImage(byte[] bytes, HttpServletRequest request, HttpServletResponse response) throws IOException {
              ServletOutputStream sout = response.getOutputStream();
              for(int n = 0; n < bytes.length; n++) {
                   sout.write(bytes[n]);
              sout.flush();
              sout.close();
         }Then in my JSP, I use this:
    <img src="/path-to-servlet/image.jpg"/>
    The name of the image to display is in the URL as well as the path to the servlet. The servlet will therefore need to extract the image name from the url and call the database.

  • Dynamic Image rendering on JSP page

    Hi All!
    I want to display images on my JSP page. However, the images should be generated dynamically (As are used by many sites during the registration process e.g., yahoo, etc..) How can i achieve this?
    plz help! Its urgent!

    Yes, but your in the wrong forum for this.
    Use the search bar to look for posts and have a look in
    http://forum.java.sun.com/forum.jspa?forumID=5
    There are forums on Multimedia which may also have some information.

  • Displaying BLOB image by using ADF Faces

    Hi all,
    I digged the forum but couldn't find any satisfied answer about displaying BLOB images by using ADF Faces.
    I have insterted POJO object to Oracle database but couldn't find any way to display blob (in java byte [] ) data in POJO.
    I have read the POJO object from database which contains two field; one of them is id field and other is BLOB data which holds GIF or JPG image and I want to display this image another page which contains also other fields / records ...
    thanks for your answers
    regards...
    --baris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    This thread at Sun : http://forum.java.sun.com/thread.jspa?threadID=513804&messageID=2445090
    talks about two options for creating a graphicImage jsf tag. (img tag)
    1. Make the img tag url refer to a servlet (instead of a static image file)
    2. Embed the image into the tag as inline base64 encoded data.
    2a. Use an <Object> tag with inline data.
    1. Looks a bit complex for a simple problem.
    2 and 2a don't work with some browsers.
    - And I've not yet figured out how to hook into the ADF Faces table-rendering logic to get it to add my image column. My table binds to a collection DataControl, [which in turn retrieves from a findAllItems call on a session facade, which uses my domain model, and wraps up access to a TopLink pesistence layer]. The framework just ignores my byte[] attribute when creating the jsf table from the DataControl. All string, int etc. attributes get represented correctly in the jsf table output.

  • Display BLOB (image) column in (interactive) report

    Hi,
    I have a field called "picture" in my table "details" which is of type BLOB. i also have a field for "MIMETYPE" and "filename"
    i additionally have a "name" and "description" columns which i need to display along with the picture as columns in a report (preferably interactive).
    i have also modified the BLOB display format as per
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r31/apex31nf/apex31blob.htm
    what i am missing is the correct query. if possible, i would like to control the size of the picture rendered within the report like say 40*50.
    I have also referred to the thread
    APEX 3.1 Display BLOB Image
    But i don't know how to place the
    dbms_lob.getlength("BLOB_CONTENT") as "BLOB_CONTENT"
    in my query.
    The above also makes the report column as of type "number". is this expected?
    Any help would be much appreciated.
    Regards,
    Ramakrishnan

    You haven't actually said what the problem is?
    >
    I have a field called "picture" in my table "details" which is of type BLOB. i also have a field for "MIMETYPE" and "filename"
    i additionally have a "name" and "description" columns which i need to display along with the picture as columns in a report (preferably interactive).
    i have also modified the BLOB display format as per
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r31/apex31nf/apex31blob.htm
    what i am missing is the correct query.
    I have also referred to the thread
    APEX 3.1 Display BLOB Image
    But i don't know how to place the
    dbms_lob.getlength("BLOB_CONTENT") as "BLOB_CONTENT"
    >
    Something like:
    select
              name
            , description
            , dbms_lob.getlength(picture) picture
    from
              details
    if possible, i would like to control the size of the picture rendered within the report like say 40*50.For images close to this size it's easy to do this for declarative BLOB images in interactive reports using CSS. Add a style sheet with:
    .apexir_WORKSHEET_DATA td[headers="PICTURE"] img {
      display: block;
      width: 40px;
      border: 1px solid #999;
      padding: 4px;
      background: #f6f6f6;
    }where the <tt>PICTURE</tt> value in the attribute selector is the table header ID of the image column. Setting only one dimension (in this case the width) scales the image with the correct aspect ratio. (The border, padding and background properties are just eye candy...)
    However, scaling large images in the browser this way is a huge waste of bandwidth and produces poorer quality images than creating proper scaled down versions using image tools. For improved performance and image quality, and where you require image-specific scaling you can use the database ORDImage object to produce thumbnail and preview versions automatically, as described in this blog post.

  • How to display an image on the HTML page by using applet

    Dear friends,
    I am now writing an java applet, I want to display an image on the HTML page, and tried the following commands:
    {color:#ff00ff}{color:#000000}Image map; //put in the class definition
    map=getImage(getCodeBase(),"hhh.gif"); //put in the function of init()
    g.drawImage(map,0,300,this); //put in the function of paint(){color}
    {color}
    However, when I run it, the image wasn't displayed at all.
    I hope who guys ever come across this problem could help me to solve it. Thank you in advance!
    Hawaii

    Hi,
    I am no expert on Images
    but
    from personal exp.
    are you sure that map actually contains the image?
    try using
    ImageIcon ii = ImageIcon(String name);
    map = ii.getImage();I saw a tutorial on images i think on sun
    where they use ImageIcon to load the image

  • Displaying Crystal reports in a JSP Page

    hello,
    Can anybody help me out in displaying Crystal reports on a JSP page.
    which needs to be deployed on weblogic server and oracle database.
    i am new to crystal report and dont have much idea how to proceed.
    if you can give me a pointer how to start then i can proceed.
    waiting for the reply eagerly

    Start with the Crystal reports site.
    [url http://www.businessobjects.com/products/dev_zone/java/default.asp?ref=devzone_main] Java zone has some documentation and basic examples on how to do it

  • How to display the content of a BLOB column in a JSP page?

    Hi,
    I've a db table with a Blob column which contains an image (".gif" file). I've created a UIX JSP page with the wizard, but I cannot display my image.
    This is my code:
    <%@ page errorPage="errorpage.jsp" contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
    <%@ taglib uri="http://xmlns.oracle.com/uix/ui" prefix="uix" %>
    <%@ taglib uri="http://xmlns.oracle.com/uix/ui/bc4j" prefix="bc4juix" %>
    <%-- Define Application Module and DataSource--%>
    <jbo:ApplicationModule configname="PackageTest.PackageTestModule.PackageTestModuleLocal" id="app1" />
    <jbo:DataSource id="ds1" appid="app1" viewobject="ProvaMediaView" rangesize="1" />
    <%-- Main page contents go here --%>
    <uix:contents>
    <uix:form name="form1" method="POST">
    <uix:labeledFieldLayout >
    <jbo:AttributeIterate id="dsAttributes" datasource="ds1" hideattributes="UixShowHide">
    <%if(dsAttributes.getName().compareTo("Image")==0){
    %>
    <bc4juix:LabelStyledText datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <jbo:EmbedImage datasource="ds1" mediaattr="Image" />
    <%}else{%>  
    <bc4juix:LabelStyledText datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <bc4juix:InputRender datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <%}%>
    </jbo:AttributeIterate>
    </uix:labeledFieldLayout>
    <uix:formValue name="RowKey" value="<%= sRowKey%>" />
    </uix:form>
    </uix:contents>
    and this is the error on running the page:
    oracle.jbo.domain.BlobDomain
    Exception Details
    javax.servlet.jsp.JspException: oracle.jbo.domain.BlobDomain
         int oracle.ord.html.jsp.datatags.ShowEmbedImageTag.doStartTag()
         void Media_Edit._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void oracle.jsp.runtimev2.JspPageTable.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
         void oracle.jsp.runtimev2.JspServlet.internalService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.jsp.runtimev2.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    How can I do?
    Thanks in advance.

    Hi,
    I've a db table with a Blob column which contains an image (".gif" file). I've created a UIX JSP page with the wizard, but I cannot display my image.
    This is my code:
    <%@ page errorPage="errorpage.jsp" contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
    <%@ taglib uri="http://xmlns.oracle.com/uix/ui" prefix="uix" %>
    <%@ taglib uri="http://xmlns.oracle.com/uix/ui/bc4j" prefix="bc4juix" %>
    <%-- Define Application Module and DataSource--%>
    <jbo:ApplicationModule configname="PackageTest.PackageTestModule.PackageTestModuleLocal" id="app1" />
    <jbo:DataSource id="ds1" appid="app1" viewobject="ProvaMediaView" rangesize="1" />
    <%-- Main page contents go here --%>
    <uix:contents>
    <uix:form name="form1" method="POST">
    <uix:labeledFieldLayout >
    <jbo:AttributeIterate id="dsAttributes" datasource="ds1" hideattributes="UixShowHide">
    <%if(dsAttributes.getName().compareTo("Image")==0){
    %>
    <bc4juix:LabelStyledText datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <jbo:EmbedImage datasource="ds1" mediaattr="Image" />
    <%}else{%>  
    <bc4juix:LabelStyledText datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <bc4juix:InputRender datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    <%}%>
    </jbo:AttributeIterate>
    </uix:labeledFieldLayout>
    <uix:formValue name="RowKey" value="<%= sRowKey%>" />
    </uix:form>
    </uix:contents>
    and this is the error on running the page:
    oracle.jbo.domain.BlobDomain
    Exception Details
    javax.servlet.jsp.JspException: oracle.jbo.domain.BlobDomain
         int oracle.ord.html.jsp.datatags.ShowEmbedImageTag.doStartTag()
         void Media_Edit._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void oracle.jsp.runtimev2.JspPageTable.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
         void oracle.jsp.runtimev2.JspServlet.internalService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.jsp.runtimev2.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    How can I do?
    Thanks in advance.

  • HOWTO: Display a custom image on a jsp page

    You need 4 files.
    1. a jsp page (index.jsp)
    2. A servlet (myPackage.ImageMaker)
    3. A supplier class (myPackage.PluggableSupplier)
    4. web.xml (your IDE should supply this)
    From the jsp page you're calling the servlet with an <img> tag, and passing it some parameters.
    The servlet obtains a BufferedImage from a pluggable supplier class, and returns with an image (png).
    The image is displayed on the jsp page. Hope this helps!
    ================================================================================================
    Here's the .jsp file (index.jsp)
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Image page</title>
        </head>
        <body>
        <h1>Your image:</h1>
        <img src="ImageMaker?Param1=Hello world&Param2=Hello again" />
        </body>
    </html>================================================================================================
    Here's the servlet (ImageMaker.java):
    package myPackage;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ImageMaker extends HttpServlet {
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            System.out.println("called");
            //Prevent chacing of the image as it's probably intended to be 'dynamic'
            response.addDateHeader("Expires", 795294400000L); //<--long ago
            response.addHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
            response.addHeader("Pragma", "no-cache");
            //set mime type and get output stream
            response.setContentType("image/png");
            OutputStream out = response.getOutputStream();
            //catch incoming parameters, as many or few as you want
            String parameter1 = request.getParameter("Param1");
            String parameter2 = request.getParameter("Param2");
            //fetch the buffered image
            int width = 100;
            int height = 50;
            PluggableSupplier ps = new PluggableSupplier(width, height);
            BufferedImage buf = ps.fetchBI(parameter1);
            /***You can now draw on the original image if you want to add a watermark or label or whatever*********/
            Graphics g = buf.getGraphics();
            g.setColor(Color.BLACK);
            g.drawString(parameter2, 5, 30);
            try {
                System.out.println("writing...");
                ImageIO.write(buf, "png", out);
            } catch(IOException ioe) {
                System.err.println("Error writing image file: " + ioe);
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
    }================================================================================================
    This is the class that supplies your image (PluggableSupplier.java):
    package myPackage;
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.image.BufferedImage;
    public class PluggableSupplier {
        BufferedImage buf = null;
        Graphics2D g2d = null;
        int width = 50;
        int height = 50;
        public PluggableSupplier(int w, int h) {
            if ((w+h)>2) {
                this.width = w;
                this.height = h;
            buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            g2d = buf.createGraphics();
        public BufferedImage fetchBI(String parameter1) {
            if (g2d != null) {
                g2d.setColor(Color.RED);
                g2d.fillRect(0, 0, width, height);
                g2d.setColor(Color.WHITE);
                g2d.drawString(parameter1, 5, 15);
            return buf;
    }================================================================================================
    finally, your web.xml should look like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <servlet>
            <servlet-name>ImageMaker</servlet-name>
            <servlet-class>myPackage.ImageMaker</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>ImageMaker</servlet-name>
            <url-pattern>/ImageMaker</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
         <welcome-file>
                index.jsp
            </welcome-file>
        </welcome-file-list>
    </web-app>null

    Another trick I learned (the hard way ;))...it's a good idea to buffer the output before responding. Add the following code to the servlet, in the case of the provided example, where all the other response-related stuff are done:
    response.setBufferSize(yourBufferSize);It's a good idea to try and calculate the buffer size as accurately as possible.

  • HELP!!!!Display blob image using JSP

    Hi,
    I am trying to blob image using JSP but it did not display successfully.
    Can someone help, please?
    below are the codes snippet:
    <td>
    <img src="display_image.jsp?ID=<%=request.getParameter("ID") %>" width="115" border="0">
    </td>
    byte[] image_blob = details.getImageByteArray();
    response.setContentType("image/jpeg");
    //response.setContentType("image/gif");
    //BEGINNING OF SECTION TO DISPLAY IMAGE
    /*OutputStream fos = null;
    fos = response.getOutputStream();
    fos.write(image_blob, 0, image_blob.length);
    fos.flush();
    fos.close();*/
    java.io.FileOutputStream fos1 = new java.io.FileOutputStream("C:\\"+id+".jpg");
    fos1.write(image_blob);
    fos1.close();
    OutputStream o = response.getOutputStream();
    System.out.println("o");
    o.write(image_blob);
    System.out.println(image_blob);
    System.out.println("write image");

    Use Java Image or BufferedImage instead of obscure byte array for image data.
    Here's an example code for a JSP document:
    <%
    String wid = request.getParameter("percent");
    String cost = request.getParameter("suchi");
    response.reset(); //IMPORTANT !
    response.setContentType("image/jpeg");
    // for testing purpose
    if (wid == null) wid = "58";
    if (cost == null) cost = "3400";
    float dleng = Float.parseFloat(wid) * 2.6f;
    RenderedImage rimg = drawGraph(dleng);
    OutputStream os = response.getOutputStream();
    try{
      ImageIO.write(rimg, "jpg", os);
    catch(IOException e){
    os.flush();
    %>
    <%!
    public RenderedImage drawGraph(float barLength){
      final int w = 800;
      final int h = 18;
      final int x = 0;
      final int y = 0;
      BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
      Graphics2D g2 = img.createGraphics();
      Color c = new Color(Integer.parseInt("FF9999", 16));
      g2.setColor(Color.yellow);
      g2.fillRect(x, y, w, h);
      g2.setColor(c);
      g2.fillRect(x, y, (int)barLength, h);
      g2.dispose();
      return img;
    %>

  • How to display BLOB image column with WEB application, JSF, ADF BC

    I looking for a way to display the content from a blob column on a WEB application, JSF, ADF BC
    The blob column contains a JPEG image.
    About the application
    The model contains a viewobject where the blob column attribute (photoimg) type is of type : BlobDomain
    Now I have to create the view to display the content of photoimg inside a JSF-JSP page.
    Any advice ?

    Search is your friend
    How to display the content of a BLOB column in a ADF/BC pages ?
    John

  • How do I display blob (image) in a Portal Report

    I am using 9ias 10222 and portal 30983 and I have a table that stores an image as a blob and have a varchar field to store the mime type. I have created a form to upload the image and can then query the form to display the image.
    How do I dislay the image in a Portal Report/Dynamic Page Component. I have followed note 68016.1 but the retrieve_img_data procedure does not work it gives a wwv-11230 error.
    Any ideas? Any help would be appreciated.
    Thanks
    Belinda

    Hi,
    Can you display what code you used for this? I followed note 172045.1 and everything compiles properly but when I run the report, I just get a box with a red X in it, like it is not finding the picture. I ran the procedure that downloads the image and it works fine from there. Thanks.

  • Displaying BLOB image in an item

    I have a table with a BLOB column holding an image.
    I can set up a report region with a query on the column like this (the whole sql query is omitted for simplicity, I am just showing relevant column):
    dbms_lob.getlength(a.product_logo)
    and then put a mask on the report column:
    IMAGE:PROJECT:PRODUCT_LOGO:PROJECT_ID::::::inline:Download
    and it works. The report region, when ithe page runs, displays the image.
    My problem is this...
    I am trying to set up a page where I already have an html region serving other purposes. I want to set up an item under that region that would display my image. I create an item of "Display As Text" type.
    I then enter my magic query dbms_lob.getlength(a.product_logo) into the item's "Source value or expression" field, while I set the "Source type" to "SQL Query". In the format mask for the item, I enter the same mask I showed above - "IMAGE:PROJECT:PRODUCT_LOGO:PROJECT_ID::::::inline:Download".
    I run the page and it doesn't work. The item comes back with a number. I am guessing it's the actual getlength value. What else am I missing? Or is it even possible to display an image BLOB through an item and not a report column?
    Thanks
    Boris

    Hi,
    Install demonstrative application and check page 6
    To install demonstrative app go
    Home>Application Builder>Create
    and select Demonstration Application
    Br,Jari

Maybe you are looking for

  • User-exit/BADI during outbound ABAP proxy call

    Hello, I want to introduce certain check during outbound ABAP proxy calls to PI. This is a generic check, failure of which would stop the proxy call to proceed and raise an exception. I would like to place this at the generic place which is called fo

  • Making itunes recognise an extrenal drive as the default location always

    Hi I am really hoping someone can put me out of my itunes misery. I have been running the following set up for a while now but it is driving me crazy and if anyone has a solution, I would really like to give it a try! I currently have itunes installe

  • LinkBar: how to set a selected button's background color?

    I was able to set the text color of a selected LinkBar button by "disabledColor" style of LinkBar. Accordingly, I expect to set the background color of the selected button by "backgroundDisabledColor" style, however, it didn't work; and except "backg

  • JDev 11.1.1.3: Column Sum needs to work like getEstimatedRowCount

    Hi there, I am working with the table component and a large dataset (thousands of rows). I need to see a column total (sum) in the column footer. Since we're dealing with a large dataset, I thought the appropriate way to do this is to select sum(colu

  • Trigger automator script when new file created

    I want to create an automator script that will recognise when a new file is created (with a name that matches a particular pattern and in a certain directory) and mail that file to a predefined address. Is that possible?