This content has been marked as final. Show 5 replies
You need to read the documentation.
You need to call the import() procedure (which indirectly calls setProperties()).
As for displaying the images, it all depends on what environment you are using. c++? Java? PL/SQL? OCCI? PHP? Web? Streaming server?..... I can't even begin to answer.
How to insert image into table as a data in Oracle 9i
Create a coulmn as BLOB datatype in the table, then import the data using InterMedia procedure into the table.
-- First step would be to create a directory in oracle and map it to the folder where your image resides.
create directory image_dir as *'c:\image_dir';*
Then you would have to use a procedure to insert the image in your table. SO first create a table to hold the image. Note that you have to use a BLOB to insert the image.
CREATE TABLE test_image
Now let's write the procedure to insert the image in the table above.
CREATE OR REPLACE PROCEDURE insert_image_file (p_id NUMBER, p_image_name IN VARCHAR2)
src_file := BFILENAME ('image_DIR', p_image_name);
-- insert a NULL record to lock
INSERT INTO temp_image
(ID, image_name, image
VALUES (p_id, p_image_name, EMPTY_BLOB ()
-- lock record
WHERE ID = p_id AND image_name = p_image_name
-- open the file
DBMS_LOB.fileopen (src_file, DBMS_LOB.file_readonly);
-- determine length
lgh_file := DBMS_LOB.getlength (src_file);
-- read the file
DBMS_LOB.loadfromfile (dst_file, src_file, lgh_file);
-- update the blob field
SET image = dst_file
WHERE ID = p_id AND image_name = p_image_name;
-- close file
Now execute the procedure to insert the image.
irwan_thio wrote:Could you give more specific decription? I still have no idea about what you said.
I want to ask something:
I use Oracle 9i intermedia
If i use this script:
CREATE TABLE images (
file_name VARCHAR2(100) NOT NULL,
CREATE OR REPLACE DIRECTORY imgdir AS 'd:/data';
INSERT INTO images (file_name, image)
VALUES ('tree', ORDSYS.ORDImage.init('file','imgdir','tree.jpg' ));
I put tree.jpg in directory d:/data in my hard drive.
Is my tree.jpg file had already get in to my images table?
I'm little <font face="tahoma,verdana,sans-serif" size="1" color="#000">confuse</font>, because when i check my table with this script:
<P>select file_name, i.image.getWidth() from images i;
it's show that my i.image.getWidth() for file_name tree is empty.. that mean my tree.jpg doesn't get in to my table.. am i correct?
N also i want to ask how to display to screen all of my image from images table?
Is it posible Oracle 9i intermedia to support display image from table?
thanks Mr Lawrence</P>