(Blob Column) Image in email

Hi All,
I am using Oracle 11g.
Can anyone please provide any link or code of adding an Image which is stored in the DB Blob column of a table to an Email.
Email is being sent through Pl/sql procedure written for it.
Please let me know if you need any more info.
Thanks in advance
Shoaib

Hello Shoaib,
where is your problem,
reading the BLOB from db?
Encoding it {message:id=10364104}?
Attaching it?
Anything else?
https://forums.oracle.com/forums/search.jspa?threadID=&q=attachment&objID=f75&dateRange=thisyear&userID=&numResults=15&rankBy=10001
Regards
Marcus

Similar Messages

  • Need help saving image to SQL as BLOB, then sending as email attachment

    Hi folks,
    These forums have gotten me most of the way through this particular project, but I'm finally stumped...
    First, I'll describe exactly what I'm trying to do: the user chooses an image file client side and the server-side code then converts it to binary data and saves it to SQL. Then as a separate step, an email will be sent out with that image file loaded from the DB as an attachment.
    So I've actually got most of this working. I'm using the O'Reilly MultipartParser class to pull the file input stream from the Request and insert it into SQL BLOB column ("image" datatype). I can successfully send Text attachments by simply converting the binary data back to a string and then using a subclass of DataSource (ByteArrayDataSource) to feed it to the mail object.
    After getting the text documents to work, I then moved on to trying to send images.
    I tried to send images using essentially the same technique as sending text. The image file gets saved to SQL the same way and I then convert the binary data back to a string an attach it. The only difference is that I set the content-type to "image/gif".
    I didn't really expect this to work, however, I am able to "Preview" very simple Gifs (in XP) that I've attached. I cannot "Open" them, though, and I cannot even "Preview" more complicated Gifs.
    So on to my real questions. I didn't really expect that you could simply output binary image data into Text format and simply slap on a ".gif" and expect it to work. Am I right about that? XP's "preview" option seems to read it okay, but I really need to be able to "open" these files.
    So basically I need to know what to DO with that binary data in SQL in order to successfully attach it as a true image file. Is this an encoding issue? MIME type?
    I didn't want to paste all the code but I'll paste the snippet that deals with the attachment section. If you'd like to see any other parts, please just let me know...
    MyBlobObject v_blob = new MyBlobObject(m_cp);  // the getBlobStr() method of this object simply grabs the data from SQL as a String
    DataSource source = new ByteArrayDataSource(v_blob.getBlobStr(),"application/octet-stream");
    BodyPart messageBodyPart = new MimeBodyPart();
    messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setHeader("content-type","image/gif");
    messageBodyPart.setFileName(v_fileName);
    ...Another interesting thing I'm seeing is that when I view the small Gif as text, I see this:
    GIF89a � !� , D ;
    While the file I'm getting from SQL as an attachment looks like this:
    GIF89a ? !? , D ;
    Obviously, the question marks are unknown, but I'm not quite sure why. I outputted the char values as integers and found that the first question mark is 65408 and the second one's value is 65529. Obviously something is getting changed somewhere in the process, but I'm not quite sure how and where.
    anyway, thanks in advance for any advice!

    Nevermind! Of course, I figured it all out after writing that long post.
    I had tried using a byte array instead of the String in the ByteArrayDataSource and it hadn't worked. However once I cleaned up the code a bit I got it working.
    This links has it all...
    http://www.magelang.com/faq/view.jsp?EID=498439
    thanks anyway!

  • Rendering images based on BLOB columns

    Hello
    I'm using JDevelpor 10G ..
    I want to render image from BLOB column , and its the first time working with servlet , I read this article
    http://www.pascalalma.net/2008/04/22/oracle-adf-medior-rendering-images-based-on-blob-columns/
    and I want to ask some questions ??
    - How can I check that the servlet is run .. I use this to call the servlet "" Do not laugh .. I am really new "
    <af:objectImage source="/render_image?img_id=#{row.ImageId}"/>
    You should read the article to understand my question
    rgds

    done , my problem was with mapping
    If you have any problem with this case I can help
    contact me
    [email protected]

  • How to insert a pdf or jpeg image into a blob column of a table

    How to insert a pdf or jpeg image into a blob column of a table

    Hi,
    Try This
    Loading an image into a BLOB column and displaying it via OAS
    The steps are as follows:
    Step 1.
    Create a table to store the blobs:
    create table blobs
    ( id varchar2(255),
    blob_col blob
    Step 2.
    Create a logical directory in the database to the physical file system:
    create or replace directory MY_FILES as 'c:\images';
    Step 3.
    Create a procedure to load the blobs from the file system using the logical
    directory. The gif "aria.gif" must exist in c:\images.
    create or replace procedure insert_img as
    f_lob bfile;
    b_lob blob;
    begin
    insert into blobs values ( 'MyGif', empty_blob() )
    return blob_col into b_lob;
    f_lob := bfilename( 'MY_FILES', 'aria.gif' );
    dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
    dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );
    dbms_lob.fileclose(f_lob);
    commit;
    end;
    Step 4.
    Create a procedure that is called via Oracle Application Server to display the
    image.
    create or replace procedure get_img as
    vblob blob;
    buffer raw(32000);
    buffer_size integer := 32000;
    offset integer := 1;
    length number;
    begin
    owa_util.mime_header('image/gif');
    select blob_col into vblob from blobs where id = 'MyGif';
    length := dbms_lob.getlength(vblob);
    while offset < length loop
    dbms_lob.read(vblob, buffer_size, offset, buffer);
    htp.prn(utl_raw.cast_to_varchar2(buffer));
    offset := offset + buffer_size;
    end loop;
    exception
    when others then
    htp.p(sqlerrm);
    end;
    Step 5.
    Use the PL/SQL cartridge to call the get_img procedure
    OR
    Create that procedure as a function and invoke it within your PL/SQL code to
    place the images appropriately on your HTML page via the PL/SQL toolkit.
    from a html form
    1. Create an HTML form where the image field will be <input type="file">. You also
    need the file MIME type .
    2. Create a procedure receiving the form parameters. The file field will be a Varchar2
    parameter, because you receive the image path not the image itself.
    3. Insert the image file into table using "Create directory NAME as IMAGE_PATH" and
    then use "Insert into TABLE (consecutive, BLOB_OBJECT, MIME_OBJECT) values (sequence.nextval,
    EMPTY_BLOB(), 'GIF' or 'JPEG') returning BLOB_OBJECT, consecutive into variable_blob,
    variable_consecutive.
    4. Load the file into table using:
    dbms_lob.loadfromfile(variable_blob, variable_file_name, dbms_lob.getlength(variable_file_name));
    dbms_lob.fileclose(variable_file_name);
    commit.
    Regards,
    Simma........

  • How to display images from BLOB column via APEX 4.0

    Hello,
    I did the following in order to display images of two Oracle records on the APEX page. I am using APEX Version : 4.0.1.00.03 , Oracle DB Version : 10.2.0.4.0.
    1. Created An oracle table TEST_FORM
    with 3 columns
    ( ID number, MIME_TYPE varchar2(255) , Image BLOB )
    2. Inserted two records
    10001, image/gif, ( actual image1)
    10002, image/gif, ( actual image2)
    3. created an Oracle procedure
    CREATE OR REPLACE PROCEDURE show_my_form ( p_image_id IN test_form.id%type) AS
    l_mime test_form.mime_type%type;
    l_length NUMBER;
    l_file_name VARCHAR2 (2000);
    lob_loc test_form.IMAGE%type;
    BEGIN
    SELECT mime_type, IMAGE
    , DBMS_LOB.getlength (IMAGE)
    INTO l_mime, lob_loc, l_length
    FROM test_form
    WHERE id = p_image_id;
    owa_util.mime_header(l_mime, false);
    htp.p ('Content-length: ' || l_length);
    owa_util.http_header_close;
    wpg_docload.download_file (lob_loc);
    END show_my_form ;
    4. In Apex 4.0
    step1. Created an interactive report on a new APEX page
    step2. Specified the following in the Region Source
    select id, mime_type, '<img src="#OWNER#.show_my_form ?p_image_id=#ID#" />' photo
    from TEST_FORM
    The column result shows as <img src="CCS.show_my_form?p_image_id=#ID#" />
    I am unable to display the column image as a link to a proper image photo.
    Could you please advise me if I missed anything ?
    Thanks a lot.
    Regards
    Susanna
    Edited by: user10318332 on 13/12/2010 15:51
    Edited by: user10318332 on 13/12/2010 20:10

    Maybe the space you have before the ? is causing issues. there shouldn't be any space.
    Your procedure looks to be much the same of one that I have.
    Have you granted execute on your procedure?
    Also, what version DB are you running? This could be another issue: http://daust.blogspot.com/2006/04/xe-calling-stored-procedures.html
    But anyway, you don't need to create your own procedure these days. You could do the following:
    in your query, have a column: dbms_lob.getlength(blob) photo ; save, then in column attributes for that column, apply a format mask. There is usually a link below the text box for the format mask - BLOB Download Format Mask, which will help you build the format mask. But it is documented here: http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/advnc.htm#BCGGJHEF
    Ta,
    Trent

  • How can I insert a image into a BLOB column in a table?

    I am using forms6i against a 10gR2 database and I have one table with a BLOB column and I try to insert a image into this column. I get ORA-01461 error.
    The curious case is that in another table with a BLOB column it works very fine.
    What happens with the first table? How can I avoid the error?
    Thanks in advance.

    Hi hyue,
    Thanks for visiting Apple Support Communities.
    If you would like to add an image to a project in iMovie for iOS, see this article for helpful steps:
    iMovie for iOS (iPad): Add photos to a project
    http://support.apple.com/kb/PH3171
    All the best,
    Jeremy

  • Displaying images stored in blob columns

    I've seen discussions on how to upload and download blob columns but I want to store a blob in the database and be able to display the blob (which is a jpg) as I would any other <img> on my web page. Instead of having to store the jpg on a file system somewhere, and use the data in the database to formulate a link to the image on the file share, I want to pull it right out of the blob. Does someone have a sample of how to do this? Can I do this?
    Thanks

    Laurence,
    If you uploaded the image via the Application Builder, you can use an image tag like so:
    &lt;img src="#WORKSPACE_IMAGES#my_image.jpg" /&gt;If you followed the upload/download how to, you should be able to reference an image like this:
    &lt;img src="download_my_file?p_file=1232897645" /&gt;Where 1232897645 is the unique ID of the uploaded image. To make referencing images easier, you could write a version of the download_my_file procedure that takes in the name of the image as a parameter.
    Sergio

  • Inserting Image into a BLOB column in Oracle9i

    Hi,
    I am unable to insert image into a BLOB column. I am using Forms 6i REL 2 and Oracle 9i. But I could do it on Oracle 8i with same Forms version.
    Same thing is true for CLOB in 9i.
    Would you please try with this code?
    TABLE
    Create table x
    (Id number,
    Name CLOB,
    Pict BLOB);
    WHEN-BUTTON-PRESSED trigge
    declare
         x varchar2(265);
    begin
         x := get_file_name;
         read_image_file (x, 'GIF', 'picture.pict');
    end;
    Take care,
    Tarek

    Forms 9i and Oracle 9i work fine together for this case.

  • Insert Image to BLOB column

    Hi,
    How can i insert a image/largefile into table (having BLOB column) from sql plus?
    Thanks

    Hi!
    Do this with PL/SQL.
    CREATE TABLE image_tbl
      filename VARCHAR2(4000),
      image   BLOB
    DECLARE
          v_blob       BLOB;
          v_srcfile    BFILE;
    BEGIN
          DBMS_LOB.CreateTemporary(v_blob, TRUE);
          DBMS_LOB.Open(v_blob, dbms_lob.Lob_ReadWrite);
          v_srcfile := Bfilename('IMAGE_DIR', 'image.gif');
          DBMS_LOB.FileOpen (v_srcfile, dbms_lob.File_ReadOnly);
          DBMS_LOB.LoadFromFile(v_blob, v_srcfile, DBMS_LOB.GetLength(v_srcfile));
          INSERT INTO image_tbl (filename, image)
          VALUES ('image.gif', EMPTY_BLOB());
          UPDATE image_tbl
          SET image = v_blob
          WHERE filename LIKE 'image.gif';
          DBMS_LOB.FileClose(v_srcfile);
          COMMIT;
    END;I hope that one will help you.
    yours sincerely
    Florian W.

  • BLOB column's image is not showing up in Forms

    Hi All,
    I am using Forms 10g. I created a default form (using wizard) for a table that has a BLOB column. Form builder automatically created an image item that corresponds to the BLOB column. The problem is that when I run the, the image item is always blank, and is not showing any image. Although I know that the BLOB column contains valid images, which I can see using PL/SQL developer tool.
    The form is compiling without error, and also, there is no runtime error message. So without reporting a compile time/runtime error, the Form is not showing the image. Can anybody help me plz??? this is urgent, any help will be greatly appreciated.
    Thanks in Advance.

    Hi,
    I am simply using the Forms default "EnterQuery" and "ExecuteQuery" buttons. I have not written a single line of code. That is, just using the forms default funcionality.
    Thanks.

  • Image stored in BLOB column crashes report's engine

    Hi,
    I have a report where I display logos stored in a BLOB column on the DB.
    The report is generated as RTF.
    When images have sizes of 624x168 or 423x324 everything is OK. One image, 1221x224, is crashig the report with a dr. Watson error.
    Any idea why?
    The size of the "bad" image file is 38K, and the "good" ones are about 300K.
    Monica

    Sajjad wrote:
    I altered student table to store photoes of students. For this I added STIMG as blob, MIMETYPE,FILENAME,IMAGE_LAST_UPDATE COLUMNS to studentadmitted table. Image stored and displayed in report very nicely. With the following query
    select "ROWID",
    "ST_ID",
    "FIRST_NAME",
    "LAST_NAME",
    "FFIRST_NAME",
    "FLAST_NAME",
    "COURSE_ID",
    "SESSION_ID",
    "CONTACT#" "CONTACT_H",nvl(dbms_lob.getlength(STIMG),0) IMAGE
    from "#OWNER#"."STUDENTADMITTED"
    Images are displayed in column but they have different sizes.Stick to declarative BLOB images as above. They can be resized in reports using CSS. Add a style sheet in the page Inline CSS property:
    td[headers="IMAGE"] img {
      display: block;
      width: 75px;
      border: 1px solid #999;
      padding: 6px;
      background: #f6f6f6;
    }where the <tt>IMAGE</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, if the original images are large then scaling them 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. Downloading megapixel images and then reducing them to thumbnail size results in pointlessly pushing millions of bytes that will never be seen.
    For improved performance and image quality, and where you require image-specific scaling the best approach is to use the database ORDImage object to produce thumbnail and preview versions automatically. Note that this is not possible in Oracle XE as Multimedia is not included

  • Displaying the image stored in Blob column

    Hi all,
    I'm trying to print the report with an image. I've stored the image in a Blob column and the format of the image is Jpg.
    I'm using the Reports 10g(10.1.2.0.2). When I'm trying to print the report, I'm getting an error Rep-62203. I want to know whether there are any settings which i need to set to display the image item. I mean to say that are there any registry settings.
    Regards,
    Alok Dubey
    Edited by: Alok Dubey on Dec 1, 2008 12:55 PM

    Hi all,
    I'm trying to print the report with an image. I've stored the image in a Blob column and the format of the image is Jpg.
    I'm using the Reports 10g(10.1.2.0.2). When I'm trying to print the report, I'm getting an error Rep-62203. I want to know whether there are any settings which i need to set to display the image item. I mean to say that are there any registry settings.
    Regards,
    Alok Dubey
    Edited by: Alok Dubey on Dec 1, 2008 12:55 PM

  • Apex 4.0 display image item :BLOB column returned by SQL statement

    Hello
    I'm creating an display image item in apex 4.0. The source is a BLOB column returned by SQL statement.
    When I'm issuing an sql statement like this:
       select lado.blob_content
       from   large_documents      lado
       ,        large_doc_headers    ladh
       where lado.ladh_nr = ladh.nr
       more criteriait works fine.
    When I create a function inside a package with the same query (in a cursor)
    function get_image(some parameters in) return blob
    Following in apex by:
    select get_image(some parameters) from dualI get a
    ORA-06502: PL/SQL: numeric or value error: character string buffer too smallAnybody any idea why this does not work?
    Regards Erik

    Hi Eric,
    the environment assumes varchar2-output by default, which will be limited to 32767 characters and may have problems with binary formats. You could define a blob-variable to select the value into.
    DECLARE
      l_blob BLOB;
    BEGIN
      SELECT get_image(some parameters)
        INTO l_blob
        FROM dual;
    END;
    /If you expect the BLOB-Content to be text (you should consider CLOB then), you may use UTL_RAW.CAST_TO_VARCHAR2 to convert the content. If your object is larger than the maximum varchar2 size, or you want to convert BLOB to CLOB, you might be interested in some converter like described here: {message:id=559749}
    Hope this is what you were searching for.
    -Udo

  • Displaying Image from ADF BC (BLOB Column) in ADF Mobile Application

    I have made an ADF BC over a database. Now I want to use that ADF BC's data control in my ADF Mobile App to display image stored in a blob column in the database!
    How should I got about it?
    Regards,
    Muhammad Zaheer

    Sir,
    I have exposed it through web services and I'm using the Web Service data control in my mobile application but the blob column is shown as output text in the data control. Now I don't know how to display the image from the blob column in my ADF mobile application.
    Looking forward for your help.
    Thank you.

  • Images in Blob Column..

    Hi
    I have a function that retrieves the blob column which has the image data. I cannot view this from Toad and get the value {hugeBLOB} when I query via Toad.
    I used it in a VB.Net app, but I'm unable to reterive the image there also. Can you please suggest how I can retrieve blob column (which has images) into a .jpg format? I need to retreive the images based on the query.
    Thanks for all suggestions.
    ASR

    Hi,
    Your question is not according to Forum. You must post your thread (for immediate response) on Oracle Forum for Dot Net/VB Forum.
    But i'm going to accept your request.
    I've inserted/ saved image in oracle 9i database. And As well i've read/displayed image into Picture Control from Oracle9i database.
    But i've used C# Dot Net (Visual Studio 2005 Professional) as front hand tool.
    Sorry for VB. One thing IMPORTANT:
    I'm going mention code in C# you can Covert into VB Dot Net. Through Online FREE Compiler(www.developerfusion.co.uk/ and click on utilities.)
    --------------------------------Here Below is C# Code ----------------------------------------------------
    Con.Open();
    string myquery = "Select Form_id,Emp_image From Employee where Form_id=2840";
    OracleCommand cmd = new OracleCommand(myquery, con);
    OracleDataReader dr = cmd.ExecuteReader();
    Boolean recordExist = dr.Read();
    if (recordExist)
    //Now displaying Picture.
    MessageBox.Show("Pic is being loaded by C#. Now");
    OracleLob blob = dr.GetOracleLob(1); //Column #, Emp_image
    Byte[] BLOBData = new Byte[blob.Length];
    //Read blob data into byte array
    int i = blob.Read(BLOBData, 0, System.Convert.ToInt32(blob.Length));
    //Get the primitive byte data into in-memory data stream
    MemoryStream stmBLOBData = new MemoryStream(BLOBData);
    //LOADING INTO PICBOX1
    Picbox1.Image = Image.FromStream(stmBLOBData);
    MessageBox.Show("Now i'm reseting it.");
    Picbox1.SizeMode = PictureBoxSizeMode.StretchImage;
    Else
    MessageBox.Show("Reocrd not found against this id.");
    Hopefully it helps you. If it is still difficult to understand don't shy to make query.
    ---

Maybe you are looking for

  • Multiple text boxes with click box verification

    I have seen issues similar to mine but they do not address my problem specifically.  To minimize file size I have two text entry boxes on the same slide.  The user is instructed to enter text then click the submit button.  The user is allowed 1 try. 

  • Discrepancies between following error readings in NI-MAX

    We are currently investigating the source of following errors in our systems. Maybe there is something wrong with our setup. We are using stepper motors with third party drivers and incremental encoders. We are using our own test program which perfor

  • Illustrator CS3 Compatibility MAC and Windows

    Hello. I've been asked to provide Adobe illustrator CS3 to 2 users. One is on a MAC operating OS X 10.4 and the other is on a Windows XP sp2 machine. Now the users are going to be sending files to each other but I've heard rumors that Illustrator is

  • How to configure weblogic client in IBM JRE

    I'm trying to get a java client (Lotus Domino java agent) app to connect to Weblogic 6.1 sp3. Both run separately fine. Domino is running with IBM JDK version : java version "1.3.1" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1) Class

  • Hinkpad yoga model number ( 20CDS02B00 ) , does it have active digitizer and pen?

    Hi I want to ask you about the thinkpad yoga model number ( 20CDS02B00 ) like the one on this link http://www.ebay.com/itm/Lenovo-12-5-ThinkPad-Yoga-Laptop-8GB-128GB-20CDS02B00-/181574001723?pt=Lapto... does this model ( 20CDS02B00 ) have active digi