Image from Oracle BLOB is not showing

Hi all!
Im trying to use this code:
<?php
//... etc
$sql = oci_parse($c, 'select * from pf2.documents ');
oci_execute($sql);
echo "<table width = 200 border = 1 cellspacing=0 cellpadding=0>";
while ($row = oci_fetch_assoc($sql)) {
echo "<tr>";
echo"<td style=background-color:#DDDEEE; align=center>";
echo $row['SHORTNAME'] ;
echo"</td>";
echo"<td style=background-color:#DDDEEE; align=center>";
print $row['FILENAME'] ->load();
echo"</td>";
echo "</tr>";
echo "</table>";
//... etc
?>
Here im trying to select and publish an image from Oracle BLOB,
but in Mozilla Firefox im getting just whong text:
яШяа�JFIF��`�`��яЫ�C� $.' ",#(7),01444'9=82<.342яЫ�C 2!!22222222222222222222222222222222222222222222222222яА�МЂ"�яД����������� яД�µ���}�!1AQa"q2Ѓ‘Ў#B±БRСр$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzѓ„…†‡€‰Љ’“”•–—�™љўЈ¤Ґ¦§Ё©ЄІіґµ¶·ё№єВГДЕЖЗИЙКТУФХЦЧШЩЪбвгдежзийкстуфхцчшщъяД�������� яД�µ��w�!1AQaq"2ЃB‘Ў±Б #3RрbrС $4б%с
Please help!
P.S.: Im using PHP 5.2.10 under Wintel platform,
Oracle 9.2.0.4,
create table DOCUMENTS
DOCID NUMBER(10) not null,
SHORTNAME VARCHAR2(30) not null,
FULLNAME VARCHAR2(250) not null,
FILENAME BLOB not null,
AUTHOR VARCHAR2(30) not null,
CREATIONDT DATE not null,
VERSION VARCHAR2(10) not null
Edited by: user502299 on 28.09.2009 5:33

I am having a similiar problem. I have created the image.php file:
<?
$query = "select a.image_file FROM officer_image a, officer_info b where a.officer_id=b.officer_id and b.officer_lname like 'LEDEZ%' ";
$stmt = @OCIParse ($db_conn, $query);
@OCIExecute($stmt, OCI_DEFAULT);
@OCIFetchInto($stmt, $arr, OCI_ASSOC+OCI_RETURN_LOBS);
$result = $arr['BLOB'];
@OCIFreeStatement($stmt);
@OCILogoff($conn);
$im = @imagecreatefromstring ($result);
if (!$im) {
$im = imagecreate(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
imagestring($im, 1, 5, 5, "", $tc);
Header("Content-type: image/jpeg");
Header("Content-Disposition: attachment; filename=filename_".uniqid(time()).".jpg");
imagejpeg($im,'',100);
imagedestroy($im);
?>
And then in the actual search web page:
<?php
          $tname = $_POST['lname'];
          $lname = "{$tname}%";
          $id = "1";
          //$query = "SELECT officer_id, image_file FROM officer_image WHERE ID='.$id.'";
          $query = "select a.image_file FROM officer_image a, officer_info b where a.officer_id=b.officer_id and b.officer_lname like 'LEDEZ%' ";
          //oci_bind_by_name($sql, ":bv", $lname);
          //oci_execute($sql);
          $stid = OCIParse($conn,$query);
          Header("content-type:image/jpeg");
          OCIExecute($stid, OCI_DEFAULT);
          while($succ= OCIFetchInto($stid,$row)) {
               foreach($row as $item) {
     $blob_message = $item->load();
               // Output the image
          //imagejpeg($blob_message);
          echo $blob_message . " " ;
          //echo "<img src="image.php?id='.$blob_message.'" border="0">. $rows['officer_id']."\">\n";
          echo "<br /><br />";
               // Free up memory
          //imagedestroy($im);
          //while ($row = oci_fetch_assoc($sql))
?>
Can anyone help?

Similar Messages

  • Urgent ! Code for Displaying Image from Oracle BLOB image on VB Form

    Hi Plz any one have any work to showing a Picuture on Visual Basic Form, i Save the Picure in table and its column type is BLOB where i save picture, now i want to show it on VB form. if anybody knows plz tell me. and if image not found then how can i handle in nvl(field,' ') function.

    Refer VB sample on Passing LOB parameters to a stored procedure. It shows how to display and insert the image from VB form to an Oracle Database in a BLOB column.
    http://otn.oracle.com/sample_code/tech/windows/ole_db/oledb8/content.html
    Chandar

  • Image from blog entry page not showing up on 'home' page of blog

    My first blog entry went well. I created a blog first page, then created an entry, and dragged a picture to that entry. I saved, published, and all looked great. Even the comment area worked. But when I created a second entry page, and dragge a picture to it, and saved, the photo is not showing up on that first page of the blog, the one that reads like a list only with a picture and teaser part of the entry...See http://web.me.com/brendatharp1/brendatharpblog/OnTheRoad/OnTheRoad.html
    The entry listing is there on the first page, and when you click on the title link, it takes you to the entry page and the photos are there. I noticed that on the first page, the Sept 13th entry with photo is inside a text box of sorts - this was the layered paper template I used and then modified. Dbl-clicking to make that box interactive shows the black floating box for dealing with the placement of the photo in that list; but that box only relates to that one photo from the 13th. If I drag and drop the 15th's photo there, it just sits over the text and doesn't interact. AND I didn't have to do that with the first entry. Any ideas out there? Thanks much, Brenda.

    Does this thread help http://discussions.apple.com/thread.jspa?threadID=1711038&tstart=15
    I have experienced this and it was because I removed the placeholder and just added the image on the entry page. I duplicate blog entries and delete content to add new stuff so don't have to reformat every time, if you do that don't remove the image just add on the top - it should replace the previous image. Hope this helps, it is frustrating at times but the more you learn the easier it becomes.

  • Smaller images from linking Word doc not showing in RH8 Webhelp

    I am using RH8 and linking Word Documents.  Will generate as WebHelp.  All images are pasted into the word documents using Snagit.  The images are varying in size and need to be that way.  It seems as though RH8 imports larger images as .jpg files and display fine but converts the smaller ones to .png files and they are not displayed.  Only a box is displayed saying the image file is missing for the smaller .png files. The larger .jpg files display fine.  Why are they coming in as different types?    Does anyone know of a work around to fix this?  Upon searching the forum for an answer I only found a script that will make all images one size.  Is there a setting either in Word or RH8 that needs to be adjusted?  Thank you for your help.

    See Snippet 125 on my site.
    If Word is treating the images differently when you paste, which seems odd, try inserting via Word's menus.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • I cannot display image (read from oracle BLOB field) on browser?

    I cannot display image (read from oracle BLOB field) on browser?
    Following is my code, someone can give me an advise?
    content.htm:
    <html>
    <h1>this is a test .</h1>
    <hr>
    <img  src="showcontent.jsp">
    </html>showcontent.jsp:
    <%@ page import="com.stsc.util.*" %>
    <%@ include file="/html/base.jsp" %>
    <% 
         STDataSet data = new STDataSet();
    //get blob field from database     
         String sql = "SELECT NR FROM ZWTAB WHERE BZH='liqf004' AND ZJH='001'";
         //get the result from database
         ResultSet rs = data.getResult(sql,dbBase);
         if (rs!=null && rs.next()) {
              Blob myBlob = rs.getBlob("NR");
              response.setContentType("image/jpeg");//
              byte[] ba = myBlob.getBytes(1, (int)myBlob.length());
              response.getOutputStream().write(ba);
              response.getOutputStream().flush();
         // close your result set, statement
         data.close();     
    %>

    Don't use jsp for that, use servlet. because the jsp engine will send a blank lines to outPutStream corresponding to <%@ ...> tags and other contents included in your /html/base.jsp file before sending the image. The result will not be treated as a valid image by the browser.
    To test this, type directly showcontent.jsp on your browser, and view it source.
    regards

  • Want to scan an image from oracle forms -- Is it possible??

    Hi all,
    I want to scan an image from oracle forms through a scanner. I have not found any help on this topic. Pls help with example or code or with demmo form.
    BR
    Tarik.
    Edited by: Tarik_kuet on Sep 9, 2008 1:39 PM
    Edited by: Tarik_kuet on Sep 9, 2008 1:39 PM

    A colleague of me did it like this:
    * the scanner is connected to a network document server.
    * the document server sends(ftp) the image to the oracle XDB
    * a form shows the scanned documents(using a view on the ftp directory in XDB using path_view)
    * in this form the user can move the scanned document(s) to a (blob field) in a table.
    Hope this helps a bit...
    Edited by: poelger on Sep 9, 2008 10:08 AM

  • Images of personas and themes not showing on getpersonas etc.

    When I try to view the personas.com site, the images of the personas do not show up on the web page. (This is not the same problem as not seeing my own persona change to the new one on mouse rollover - that form of previewing does work.) The same thing happens with themes on the themes page. Both sites are whitelisted for "install extensions or themes", and all adblock and ghostery etc turned off for these sites. I have also checked my hosts file - there is no mozilla or getpersonas entry. Sessional cookies allowed.

    You're welcome.
    A setting of 3 for the pref permissions.default.image means that you only allow images from the originating domain and block images from other (third-party) domains.

  • I tried to display gif image from oracle to jsp but nothing appear

    i tried to display image from oracle DB to jsp directly without using file processing , and i used Servlet and jsp , Servlet to get image from DB and jsp to use <img> tag , when i Run Servlet code
    the image appaer on Microsoft Photo Editor , and when i run jsp the image dose not appear on jsp page , so please anyone has an idea about this broblem ,send the soluation or any information to my e-mail [email protected] , and I'll thankful about your help.
    the Servlet and jsp code are below .
    thank for your help
    Servlet:
    import java.io.InputStream;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    public class Servlet extends HttpServlet
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    response.setContentType("image/gif");
    int id = Integer.parseInt(request.getParameter("no"));
    // int id = 2 ; when Run Servlet .
    ResultSet rs = null;
    Connection Lcon = null;
    String stmt = " select Image from ImageTable where lmage_id ="+id;
    Statement sm = null;
    String data1 ="";
    try
    Lcon = getConntcion();
    sm = Lcon.createStatement();
    rs = sm.executeQuery(stmt);
    if(rs.next())
    InputStream in = rs.getBinaryStream(1);
    ServletOutputStream sout = response.getOutputStream();
    int c;
    while((c=in.read())!= -1)
    sout.write(c);
    in.close();
    sout.flush();
    sout.close()
    }catch(Exception e)
    System.out.println("error in selectValue the error is "+e);
    finally
    rs .close( );
    sm .close( );
    Lcon.close( );
    public Connection getConntcion()
    Connection con = null;
    try{
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = DriverManager.getConnection(",,,,,,,, DB Info ,username and password ,,,,,,,,,,,");
    }catch(Exception e)
    System.out.println("error in connection the error is "+e);
    return con;
    Jsp code :
    <%@ page contentType="text/html"%>
    <html>
    <head
    </head>
    <title> testing image </title>
    <body>
    <form>
    <img src="servlet/Servlet?no=2">
    </form>
    </body>
    </html>

    InputStream in = rs.getBinaryStream(1);
    byte[] image= null;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    byte[] buffer = new byte[8192];
    int bytesRead = 0;
    while ((bytesRead = in.read(buffer, 0, 8192)) != -1)
         baos.write(buffer, 0, bytesRead);
    image= baos.toByteArray();
    in.close();
    ServletOutputStream sout = response.getOutputStream();
    if (image != null)
           sout.write(image);
           sout.flush();
    }

  • GetBlob Error During fetching of Images from Oracle 10g

    Dear Sir,
    By using getBlob Function ,i am getting following error:"Unsupportable action has performed".
    I am using oracle 10g.I am using java code to retrieve image from Oracle 10g.
    So plz help me by giving full code with explaination.
    Thankyou.
    Yours Obedient
    Dipesh Kumar

    I seriously doubt Oracle would write error messages with such atrocious English.
    So it's almost certainly an error from either your own code or code you're calling in some library or part of the application you're not mentioning that noone here except you has knowledge of.
    Ergo, we're not going to be able to help you unless you provide a lot more information.
    And no, we're not going to write your code for you.

  • Image in MIME Repository is not showing on WAD or Webreport

    Hi,
    The image logo.gif is stored and can be shown in MIME Repository /sap/bw/Customer/Images. I have developed a webtemplate in WAD 7.0 addresses to those images by
    <img alt="logo" src="/sap/bw/Mime/Customer/Images/logo.gif />
    It is not showing i WAD nor in webreport when it is executed from WAD.
    I have tried <img alt="logo" src="bwmimerep://sap/bw/Mime/Customer/Images/logo.gif />
    it does not work neither.
    I have also tried to test the URL directly on the webbrowser  without success
    http:// (application server with port number)/sap/bw/Mime/Customer/Images/logo.gif
    What is the problem? How to make it work?
    Thanks and best regards,
    Zabrina

    hi,
    maybe the folder containing your logo is not served, so try this:
    tcode SICF and search if your folder is served or not (grayed), if it's grayed then right click the main service (sap) deactivate and activate again.
    you can also try to put your logo in folder under  /sap/bw/bex
    hope it helps.

  • When capturing images from a Nikon D600, they show in Bridge, but when clicked to load into CS6,an error message says that it is the wrong type of document, even jpeg files. This is a NEW frustration.

    When capturing images from a Nikon D600, they show in Bridge, but when clicked to load into CS6,an error message says that it is the wrong type of document, evne jpeg files. This is a NEW frustration.

    Nikon raw files would open up in Adobe Camera Raw and so should jpegs.
    If you select one in Bridge and give the command "Ctrl r" (Windows), what happens?
    Also what is the version of ACR in the title bar?
    Gene
    Note: unmark your question as "answered". the green balloon next to the subject shows it as "solved".

  • I want to scan an image from oracle developer 10g ?

    Hi everybody.
    How can I scan an image from oracle developer 10g ?
    thnaks in advance..

    we did this in a similar way RajeshAlex describes.
    We used software "imaging professional" which was able to be controlled via a command-file and told by that command-file to store the scan-result into a local file.
    What we did was:
    Copy command-file to client via WEBUTIL_FILE.AS_TO_CLIENT..
    Execute command-file via WEBUTIL.CLIENT_HOST
    Show Forms-Alert on which the user has to click after scanning was finished
    Check local file which was defined in command-file and, if present, load it into the database using WEBUTIL_FILE.CLIENT_TO_DB..
    Hope this helps

  • I have a new iPad air and all of my photos from the cloud are not showing up on my new iPad air. How do I get all my photos to show up?

    Hi, I have a new iPad air, all of the photos from the cloud are not showing up. What do I need to do to get all my photos from the cloud onto my new iPad air? Thanks!!

    Reset your device: hold down the home button along with the sleep/wake button until the screen goes black and you see the Apple, then let go. (No data loss)

  • Shared printer from a pc does not show up on my printer list.

    I have a macbook air and the shared printer from a pc does not show up on my printer list.  I know it's available on the network as I have a another pc that has access to it.  The Mac did find it at one time but it has since disappeared.  Appreciate help.
    Rich

    Can you see the CD ripped songs in iTunes itself? Can you then right-click and select "Show in Windows Explorer"?

  • I download two free games from itunes, it is not showing up on my iphone. Help

    I downloaded two free games from itunes, it is not showing up on my iphone as an icon.  I see it when i have my phone linked to the computer,

    I think I may have confused you and I apologize. But you are also confusing me now.
    If you were not using restrictions before, then that is why the Allowed Content for Movies in in accessible. You can only access that if you had set a restrictions Passcode. If you do not have restrictions set, then it is a non issue and don't worry about that suggestion.
    Were you actively using restrictions on the iPad? If you weren't then you don't have to enable it now. That will not do any good.

Maybe you are looking for

  • Printer will not connect wirelessly / HP installer network ui plugin has stopped

    I have tried uninstalling and reinstalling my Photosmart software multiple times in an effort to connect the printer to my wireless network (WEP).  Each time I try, the software installs but will not allow me to connect the printer to my wireless net

  • Problem with Pro*C/C++ complie in linux

    I install Oracle8.1.7 in my Mandrake 7.2 ( like redhat7.1) , and it works well except with proc not works well. when I complie the precomp demo program, it gives much errors. I note the proc config file length was zero. The following is errors I get

  • Can't set sample rate 1609

    Hi, we've recently upgraded to LV 8.6 and DAQmx 8.7 and then got problem with the data aquisition that uses the DAQmx API. For example, we have a cDAQ-9172 and 9239 AI module. The device could be user configured and a typical configuration could be a

  • How can I uninstall leopard ?!!

    I hope someone can help me. I bought Lepoard last week and I want it out of my MacBook Pro. Its slowing my computer down. How can I go back to Tiger? Will all the leopard components be definitely gone? Thanks! regards to all.. / Alexis

  • Real-Time streaming stocks not great on Leaopard

    I am using OptionsXpress with Java real-time streaming is too slow on Leopard via Safari or Firefox and previous OS 10.4.x was great with Java Real-Time streaming both work with Safari and Firefox. Is something there I need download or it is Leopard