Link to home
Start Free TrialLog in
Avatar of NiceMan331
NiceMan331

asked on

reading image in oracle form

hi
i have oracle form
text item << s_item
when i type item code , it show me some information of the item
i added image item to the form to display image of the item
i put the images "jpg" format under one folder  "item_photo"
but not all items has image
i want to display image item when i type item code in s_item
to avoid item not found
i created this function as i found
CREATE OR REPLACE FUNCTION file_exists(p_fname IN VARCHAR2) RETURN BOOLEAN
AS
  l_file UTL_FILE.FILE_TYPE;
BEGIN
  l_file := UTL_FILE.FOPEN(SUBSTR( p_fname, 1, instr(p_fname,'/',-1) ),
                           SUBSTR( p_fname, instr( p_fname, '/', -1)+1 ), 'r' );   
  UTL_FILE.FCLOSE( l_file );
  RETURN TRUE;
EXCEPTION
  WHEN UTL_FILE.INVALID_PATH      THEN RETURN FALSE;
  WHEN UTL_FILE.INVALID_OPERATION THEN RETURN FALSE;
END;

Open in new window


then when validate item of s_item i added this code
IF ( file_exists( 'j:\Item_Photo\71030126.jpeg' ) ) then
	READ_IMAGE_FILE('j:\Item_Photo\71030126.jpeg','jpeg','genral.im_item');
end if

Open in new window


but image not found as per the message
(the image is exist in the image folder)
i tried also to change from jpeg to jpg
but same error
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Not sure if this is problem still exists in your Forms version but there appears to be different types of JPEG and what Forms supports:
https://community.oracle.com/thread/36256
Avatar of NiceMan331

ASKER

so , you mean i have to convert the photos to JFIF ?
I'm really not saying anything.  Just pointing out that older versions of Forms would not handle all types of JPEG images.
I'm using forms 6i , what is your advice now ?
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great , now I have to create new topic in different area about how to convert to jfif
yes ok slightwv
the image being loaded to the form
remaining 2 things
1- the function of file_exist not works here , it always gives false even the file exists
i want to solve issue if file not exits
2-i have only small space in the form for the image , but the images becomes not in full size , how to adjust
to display the whole image
1:  Comment out the exception handler and see which exception is being generated.  Then we can go from there.

Since you are using the actual OS path, I'm guessing you have set up UTL_FILE_DIR in the init file.  Can you post the values for it?


2:  I'm not a forms person so I cannot say how to make the image display as a thumbnail.
ok , please give me a chance till Saturday to try it
because now the office closed
thanx
1:  Comment out the exception handler and see which exception is being generated.  Then we can go from there.

it gives this exception
WHEN UTL_FILE.INVALID_PATH      THEN RETURN FALSE;

Since you are using the actual OS path, I'm guessing you have set up UTL_FILE_DIR in the init file.  Can you post the values for it?
i didn't understand which value i have to post ?
UTL_FILE_DIR is a spfile/fpile paramter:
http://docs.oracle.com/cd/E11882_01/server.112/e40402/initparams270.htm#REFRN10230

If you use a path not an Oracle directory, you must had the path set in UTL_FILE_DIR.  Changing this requires bouncing the database.

Your DBA should be able to help you with this.
ok , in here i have to close this question and open another 2 for my other 2 requirement
the file path & the image size
thanx