2 Replies Latest reply: Sep 29, 2006 9:48 AM by 536616 RSS

    Help needed --- Loading & Retrieving Images using Intermedia DataTypes

    536616
      Hi

      I am new to Intermedia and i am building my first application using InterMedia.
      As per examples in 'Oracle interMedia Users Guide and Reference' i created a table two columns of which one columns datatype is ORDSYS.Image.

      Below is the sql i used to create the table
      " Create table ImageTable ( ID Number, thumb ORDSYS.ORDIMAGE) "

      I loaded the Image on my localsystem into the table using the SQL Procedure given in the example and the SQL Procedure ran successfully.
      Now when i try to retrieve theh properties of the Image thats loaded into the database i get nothing.

      Here is the select query i used to retreive the properties of the loaded image
      "select A.ID, A.THUMB.getWidth() from ImageTable A"

      Can you please tell me what am i doing wrong? how can i retreive the properties of the loaded image?

      Below is the sql procedure i used to load the image into the table.

      DECLARE
      -- application variables
      Image ORDSYS.ORDImage;
      ctx RAW(4000) := NULL;
      BEGIN
      INSERT INTO ImageTable VALUES (
      1, ORDSYS.ORDImage.init()
      );
      -- Select the newly inserted row for update
      SELECT image INTO Image FROM ImageTable
      WHERE id = 1 for UPDATE;

      Image.setSource('file','ORDIMGDIR','test.jpg');
      Image.import(ctx);

      UPDATE ImageTable SET image = Image WHERE id = 1;
      COMMIT;
      -- Continue processing
      END;
      /

      -Lavanya
        • 1. Re: Help needed --- Loading & Retrieving Images using Intermedia DataTypes
          251301
          It looks like the content is loaded into the IMAGE column but your query is selecting from the THUMB column.
          • 2. Re: Help needed --- Loading & Retrieving Images using Intermedia DataTypes
            536616
            Hi Rabbott

            Thanks for the reply. I had a typo in earlier post.

            Below is the correct pl/sql that i used to load image into the table.

            Please let me know what might be causing the problem?
            I am not sure if its a prob but just wanted to let you know that i ftp'ed the image from windows to unix machine. I have Oracle 10G database on Unix.

            Thanks for your help.

            DECLARE
            -- application variables
            Image ORDSYS.ORDImage;
            ctx RAW(4000) := NULL;
            BEGIN
            INSERT INTO ImageTable VALUES (
            1, ORDSYS.ORDImage.init()
            );
            -- Select the newly inserted row for update
            SELECT thumb INTO Image FROM ImageTable
            WHERE id = 1 for UPDATE;

            Image.setSource('file','ORDIMGDIR','test.jpg');
            Image.import(ctx);

            UPDATE ImageTable SET thumb = Image WHERE id = 1;
            COMMIT;
            -- Continue processing
            END;
            /