Home » Developer & Programmer » Forms » IMAGE ON FORM 6i
IMAGE ON FORM 6i [message #415103] Fri, 24 July 2009 15:56 Go to next message
milikiel
Messages: 88
Registered: May 2009
Member
HI EVERYONE
Please assist me on how to display an image(blob) on a form . i have tried all i could but still failed to display it on the form.Yes i searched the forum without any break through.
below is the code i used to create data block and upload photos (JPG). the only problem am facing is retrieving them from forms. am using form 6i 10g database.
Thankyou.
i ll applreciate if one gives me a step by step on doin this.
the below code works fine.


conn system



grant connect, resource, imp_full_database, exp_full_database to en;

grant create any directory to EN;
grant create any library to EN;



GRANT EXECUTE ON CTX_DDL en;



CONN en/en@pacific
Connected

CREATE TABLE my_docs (
id NUMBER(10) NOT NULL,
name VARCHAR2(200) NOT NULL,
doc BLOB NOT NULL
)



ALTER TABLE my_docs ADD (
CONSTRAINT my_docs_pk PRIMARY KEY (id)
);



CREATE SEQUENCE my_docs_seq;



CREATE OR REPLACE DIRECTORY documents AS 'C:\work';


CREATE OR REPLACE PROCEDURE load_file_to_my_docs (p_file_name IN my_docs.name%TYPE) AS
v_bfile BFILE;
v_blob BLOB;
BEGIN
INSERT INTO my_docs (id, name, doc)
VALUES (my_docs_seq.NEXTVAL, p_file_name, empty_blob())
RETURN doc INTO v_blob;
v_bfile := BFILENAME('DOCUMENTS', p_file_name);
Dbms_Lob.Fileopen(v_bfile, Dbms_Lob.File_Readonly);
Dbms_Lob.Loadfromfile(v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile));
Dbms_Lob.Fileclose(v_bfile);
COMMIT;
END
;
/



-- CREATE A FOLDER NAMED WORK IN C DRIVE OF ORACLE SERVER MACHINE & PUT THE IMAGE FILE (APPL_FORM.PDF,CIMG1860.JPG)
-- YOU WANT TO STORE IN ORACLE TABLE IN THAT FOLDER. THEN EXECUTE THE PROCEDURE load_file_to_my_docs.

EXEC load_file_to_my_docs('APPL_FORM.PDF');



EXEC load_file_to_my_docs('CIMG1860.JPG');



COMMIT;
Re: IMAGE ON FORM 6i [message #415269 is a reply to message #415103] Mon, 27 July 2009 00:19 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Although you may be using Oracle Forms, your question is more SQL related that Forms related. I will move your thread.

David
Re: IMAGE ON FORM 6i [message #415277 is a reply to message #415103] Mon, 27 July 2009 00:52 Go to previous messageGo to next message
Michel Cadot
Messages: 59279
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
And the problem is?

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.

Regards
Michel
Re: IMAGE ON FORM 6i [message #415283 is a reply to message #415269] Mon, 27 July 2009 01:10 Go to previous messageGo to next message
milikiel
Messages: 88
Registered: May 2009
Member

Hi Davd, my problem isnt sql .my problem is retrieving image stored on a datablock from oracle forms 6i .i have searched the forum but still failed to solve my problem.
Thankyou.



Re: IMAGE ON FORM 6i [message #415285 is a reply to message #415269] Mon, 27 July 2009 01:11 Go to previous messageGo to next message
Frank
Messages: 7877
Registered: March 2000
Senior Member
djmartin wrote on Mon, 27 July 2009 07:19
Although you may be using Oracle Forms, your question is more SQL related that Forms related. I will move your thread.

David

The OP mentioned that the code does work fine, he just doesn't seem to know how to implement this in Forms. I wonder why you think this is not For128232716531729
Content-Disposition: form-data; name="msg_id"

415285

[Updated on: Mon, 27 July 2009 01:12]

Report message to a moderator

Re: IMAGE ON FORM 6i [message #415298 is a reply to message #415285] Mon, 27 July 2009 02:45 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Sorry guys, I saw all that SQL in the first post and assumed the OP posted it because they had a problem with it.

Search this forum for 'blob image'. There are tons of threads and some even have working code attached. Basically, create a form with a block based on your table, run the form as it is presented and it should work. If not then you need to do something in the post-query to populate the image. I can't remember which.

David
Re: IMAGE ON FORM 6i [message #415315 is a reply to message #415103] Mon, 27 July 2009 04:29 Go to previous messageGo to next message
shahzaib_4vip@hotmail.com
Messages: 373
Registered: December 2008
Location: karachi
Senior Member
Your Code is working fine its show me the picture which i put in c:\work


Let me know whats the error coming


Regards


Shahzaib ismail
Re: IMAGE ON FORM 6i [message #415352 is a reply to message #415298] Mon, 27 July 2009 06:16 Go to previous messageGo to next message
milikiel
Messages: 88
Registered: May 2009
Member
hi shaz.Thankyou very much for your quick reply.
may be am doin it wrong somewhere.just help please me with the codes to write on the actual form.Also i want the blob image retrieved to match with employee_number field on the form(:employee_details.employee_number).
am using forms 6i and 10G databaSE.

Thankyou.
Goodtimes.
Re: IMAGE ON FORM 6i [message #486543 is a reply to message #415103] Thu, 16 December 2010 06:27 Go to previous messageGo to next message
shafaat
Messages: 3
Registered: December 2010
Location: Quetta
Junior Member
Dear
I am new in oracle I using oracle 9i Database and Form 6i want to display picture through form control

I try your code it work on SQL screen but it not work on form please help me and solve my problem your reply if very urgent required send on this email address shafaatali_8@yahoo.com


Re: IMAGE ON FORM 6i [message #604006 is a reply to message #486543] Sun, 22 December 2013 11:49 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 282
Registered: August 2002
Senior Member
Create folder on any drive like D:\photo:
createan image item on form and set database property to no.also see that pictureof prperty pallet.
./fa/11479/0/
then use this code in post query at form level.

DECLARE
tiff_image_dir VARCHAR2(80) := 'D:\Photo\';
photo_filename VARCHAR2(80);
BEGIN
:System.Message_Level := '25';
photo_filename := tiff_image_dir||LOWER(:IID)||'.JPG';


READ_IMAGE_FILE(photo_filename, 'JPEG', 'inout.im');
IF NOT FORM_SUCCESS THEN
MESSAGE('This Student does not have a photo on file.');
END IF;
:SYSTEM.MESSAGE_LEVEL := '0';
END;

  • Attachment: Image25.JPG
    (Size: 49.49KB, Downloaded 550 times)
Re: IMAGE ON FORM 6i [message #604112 is a reply to message #604006] Tue, 24 December 2013 03:48 Go to previous messageGo to next message
milikiel
Messages: 88
Registered: May 2009
Member
Hi Shahzad-ul-hasan

Thank you for your assistance.

i have done everything as you instructed Unfortunately I'm getting an error when I compile and the error is related to (:IID).

The actual scenario of my form is, it has a unique reg number plus other Items and now an image has to be linked to reg number. How do I do it chief?

Thank you,Merry Christmas.
Re: IMAGE ON FORM 6i [message #604124 is a reply to message #604112] Tue, 24 December 2013 04:45 Go to previous messageGo to next message
ranamirfan
Messages: 529
Registered: January 2006
Location: Pakistan / Saudi Arabia
Senior Member

Quote:

I'm getting an error when I compile and the error is related to (:IID).


The reg number & Image Name should be same.


Regards,
Irfan
Re: IMAGE ON FORM 6i [message #604147 is a reply to message #415103] Tue, 24 December 2013 20:38 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 282
Registered: August 2002
Senior Member
Dear brother,
Mr. Irfan is correct.please replace iid with your unique reg no.

[Updated on: Tue, 24 December 2013 20:38]

Report message to a moderator

Re: IMAGE ON FORM 6i [message #604164 is a reply to message #604147] Wed, 25 December 2013 07:28 Go to previous messageGo to next message
mughals_king
Messages: 351
Registered: January 2012
Location: pakistan
Senior Member
have you solved your problem
Re: IMAGE ON FORM 6i [message #604225 is a reply to message #604164] Thu, 26 December 2013 07:53 Go to previous messageGo to next message
jgjeetu
Messages: 236
Registered: July 2013
Location: India Delhi Rohini Sec-1
Senior Member

its very simple and easy bro , just follow these steps (working for both 6i and 10g)

Step 1:-
>create table images(id number ,pic long raw)
>insert into images (id) values(1)
>insert into images (id) values(2)
>commit;

Step 2:-
now open form bulider 6i or 10g
b. create a block using imaages as base table
3. select layout style as 'form'
4. now in layout editor i.e F2 select image and press F11(or right click then select smart tiggers)
you can use when_mouse_doubleclick / when_mouse_click /when_image_pressed or when_image_activated etc
Now add this code inside trigger:-
read_image_file('c:\123.jpg','jpg','block.itemname'); i.e (imagepath,imagetype,imageitem)
step 3:-
Now everything is done , run you form Smile





Re: IMAGE ON FORM 6i [message #604896 is a reply to message #604225] Sun, 05 January 2014 17:09 Go to previous messageGo to next message
milikiel
Messages: 88
Registered: May 2009
Member
Hi Shahzad-ul-hasan,

Happy new year.

Sorry for the late come back and Thank you for your help .Unfortunately it doesn't work. I corrected the IID issue and compiled successful.But I get an error "unable to resolve reference to item out.im"

Any help?

Thank again
Re: IMAGE ON FORM 6i [message #604908 is a reply to message #604896] Mon, 06 January 2014 00:30 Go to previous messageGo to next message
ranamirfan
Messages: 529
Registered: January 2006
Location: Pakistan / Saudi Arabia
Senior Member

Dear,
Quote:

I get an error "unable to resolve reference to item out.im


Check your Image Item name I am thinking you put your Image Item name wrong in code.

Regards,
Irfan
Re: IMAGE ON FORM 6i [message #604916 is a reply to message #604225] Mon, 06 January 2014 02:46 Go to previous messageGo to next message
milikiel
Messages: 88
Registered: May 2009
Member
Hi Igjeetu

I have Google everywhere still not getting it.I want the image to match the ren_number on the form this is what i have done so far.


create table graphics_table(
bfile_id varchar(20),
bfile_loc bfile,
bfile_type varchar2(4)
)
/

then




INSERT INTO graphics_table
VALUES(4,bfilename('C:\PHOTO\','SRB000002.JPG'),'JPEG');


ist right?

what do I right on the form now?

Please help.
Re: IMAGE ON FORM 6i [message #604917 is a reply to message #604896] Mon, 06 January 2014 02:47 Go to previous messageGo to next message
milikiel
Messages: 88
Registered: May 2009
Member
Hi

I have Google everywhere still not getting it.I want the image to match the ren_number on the form this is what i have done so far.


create table graphics_table(
bfile_id varchar(20),
bfile_loc bfile,
bfile_type varchar2(4)
)
/

then




INSERT INTO graphics_table
VALUES(4,bfilename('C:\PHOTO\','SRB000002.JPG'),'JPEG');


ist right?

what do I right on the form now?

Please help.
Re: IMAGE ON FORM 6i [message #604922 is a reply to message #604896] Mon, 06 January 2014 03:20 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 282
Registered: August 2002
Senior Member
send me your fmb so i find /locate the error was????

Re: IMAGE ON FORM 6i [message #604963 is a reply to message #604922] Mon, 06 January 2014 09:52 Go to previous messageGo to next message
milikiel
Messages: 88
Registered: May 2009
Member
Hi shahzad

Here is the form.

I removed the image earlier so as I could proceed with other stuff on the same form.

Thank you.
Re: IMAGE ON FORM 6i [message #604966 is a reply to message #604963] Mon, 06 January 2014 10:25 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 282
Registered: August 2002
Senior Member
create a folder on d-Drive as:
d:\photo\
and put th (reg_number.jpg) files in that and execute it.
please check the attached form.

[Updated on: Mon, 06 January 2014 10:48]

Report message to a moderator

Re: IMAGE ON FORM 6i [message #605663 is a reply to message #604916] Mon, 13 January 2014 04:26 Go to previous message
jgjeetu
Messages: 236
Registered: July 2013
Location: India Delhi Rohini Sec-1
Senior Member

see this video http://www.youtube.com/watch?v=Ai2mPwtaues
Previous Topic: Error: To retrieve the Information in this block, use menu option view in oracle apps form
Next Topic: decode in formula column in oracle form
Goto Forum:
  


Current Time: Tue Sep 30 16:03:22 CDT 2014

Total time taken to generate the page: 0.11674 seconds