Content: Show Pictures in Oracle-Forms Example 1: Fetch a Picture from database , show it in Forms EXAMPLE 2: Fetch a Picture from database , show the Picture in a BROWSER-Window Example 3: Read Picture from Filesystem display it in Forms --------------------------------------------------------- -- Example 1: Fetch a Picture from database , show it in Forms -- Example 1 Step 1: CREATE TABLE EXAMPLE_DOCUMENTS ( DOC_ID NUMBER(10) NOT NULL, PIC_DESCRIPTION VARCHAR2(120), mymimetyp VARCHAR2(120), PICTURE ORDSYS.ORDIMAGE -- ... ) COLUMN PICTURE NOT SUBSTITUTABLE AT ALL LEVELS TABLESPACE DIGIDOCS PCTUSED 40 PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 64K NEXT 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT ) LOGGING NOCOMPRESS LOB ("PICTURE"."SOURCE"."LOCALDATA") STORE AS ( TABLESPACE DIGIDOCS ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10 NOCACHE INDEX ( TABLESPACE DIGIDOCS STORAGE ( INITIAL 64K NEXT 1 MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )) ) NOCACHE NOPARALLEL MONITORING; Example 1 Step 2: -- To show the Picture i.E. build the Where-Clause in a block, where you can get the query-condition, i.E document.doc_id. -- When you execute i.E. a WHEN-Button_Pressed-Trigger, the PL/SQL-Ode could look like this: DECLARE def_where VARCHAR2(200); BEGIN def_where := 'doc_id = '||:documents.doc_id; -- Basetable of myPreviewBlock is the Table "EXAMPLE_DOCUMENTS" too. set_block_property('myPreviewBlock',DEFAULT_WHERE, def_where); go_block('myPreviewBlock'); execute_query; END; --------------------------------------------------------- EXAMPLE 2: Fetch a Picture from database , show the Picture in a BROWSER-Window EXAMPLE 2 step 1: create a DatabaseAccessDescriptor DAD -- means, make entries in :ORACLE_HOME/Apache/modplsql/conf/dads.conf -- EXAMPLE 2 step 2: create a procedure to show Picture in a Browser-Window procedure prc_show_document ( p_id in varchar2) is v_mimetyp varchar2(255); v_blob blob; BEGIN select PICTURE ,nvl(mymimetyp,'application/pdf') into v_blob,v_mimetyp from EXAMPLE_DOCUMENTS where DOC_ID = P_ID; sys.owa_util.mime_header(v_mimetyp); sys.wpg_docload.download_file (v_blob); end; EXAMPLE 2 Step 3: Call the procedure (prc_show_document) from your Forms_applikation i.E. When-Button_Pressed: DECLARE v_url varchar2(2000); BEGIN -- v_url := fnc_get_my_dad('PICTUREDAD'); -- if you documented your DAD"s in a DatabaseTable, -- you can make a select or write a function returing DAD. -- v_url := v_url||'prc_show_document?p_id='; v_url := 'http://'||v_url||'prc_show_document?p_id='; synchronize; web.show_document(v_url||P_ID); END; --------------------------------------------------------- Example3: Read Picture from Filesystem display it in Forms 3.1 Read from the FormsServer -- If your documents are availible for FORMS, you can use this example to build a Procedure, -- which read an image into a Forms-Imageitem. -- Built a block in Forms not based on a table(controll-block) , in my case "CTRL_Z" -- ( controll-block, I don't want save the document in the database.) -- created an IMAGE-ITEM "CTRL_Z.IMG_OBJ" / Attributes: Imageformat -> TIFF in my case -- Show Palette = YES ( Image Manipulation at runtime) -- Sizing Style = Adjust DECLARE p_image_dir VARCHAR2(80) := 'c:\'; pic_file varchar2(60) := 'xxx'; path_filename VARCHAR2(145); img_typ varchar2(6) := 'TIFF'; -- GIF, BEGIN path_filename := p_image_dir||pic_file||'.tif'; READ_IMAGE_FILE(path_filename, img_typ, 'CTRL_Z.IMG_OBJ'); IF NOT FORM_SUCCESS THEN MESSAGE('File coud not opened'||path_filename); END IF; END; 3.2 Read from the FormsClient If the File is located on the Client-PC, use Webutil.dll. - Install the webutil-package - Make changes in Webutil.cfg, to allow upload from Client. - Replace, in example 3.1, calls to READ_IMAGE_FILE with CLIENT_READ_IMAGE_FILE.