Home » Developer & Programmer » Forms » Opening Picture (Oracle Developer 6i)
Opening Picture [message #599376] Thu, 24 October 2013 00:37 Go to next message
amjad_alahdal
Messages: 102
Registered: October 2013
Location: Saudi Arabia
Senior Member
Hello every one
I would like to ask a very small question. what is the code that should be written to open a picture inside the button.
I have already made the button, and the trigger is when push button, what I want is when I click the button it opens a picture in this directory
F:\Amjad\Amjad\amjad\1.jpg


the name of the picture is taken from table1 the colum serial_number

Thank you
Re: Opening Picture [message #599377 is a reply to message #599376] Thu, 24 October 2013 00:44 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Hi I've moved your thread to the Forms section.

Now, as for your question. So you want to invoke an OS command to show a picture My best bet (It's been a long time since I've used Forms) is to use WEB.SHOW_DOCUMENT(<full path to the image>). Note that the webserver running your Forms needs to be able to access this path.

MHE
Re: Opening Picture [message #599378 is a reply to message #599377] Thu, 24 October 2013 00:51 Go to previous messageGo to next message
amjad_alahdal
Messages: 102
Registered: October 2013
Location: Saudi Arabia
Senior Member
Sorry
and thanks

well,
I'm sorry Sir,
Maybe I didn't explain my question well. So, I created a button in oracle 6i developer.
Created a trigger, when button pressed
so, what I want is, when I click the button, it opens a picture in this directory for example :
F:\Amjad\Amjad\amjad\1.jpg
look, the name of the image is taken from an item of the block , the block name is My_table1, the item is Serial Number
so it should be,
My_table1.serial_number that refers to the name of the picture
Re: Opening Picture [message #599390 is a reply to message #599378] Thu, 24 October 2013 02:44 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
What do you mean when you say "it opens a picture"? In an image item? In a browser? Most web browsers know how to handle images, so my guess is that web.show_document will work, although I'm not sure whether the path you provide should be known client side or on the IAS side. That is something I need to check.

MHE
Re: Opening Picture [message #599399 is a reply to message #599390] Thu, 24 October 2013 03:55 Go to previous messageGo to next message
Littlefoot
Messages: 21811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As you use Forms 6i: is this a client-server application, or is it deployed to web? If client-server, maybe HOST built-in would do the job as well; try to specify image name only (as Maaher said - operating system (Windows, right?) *should* be able to open it that way).

For example (untested - I don't have Forms 6i at all and I don't have ANY Forms available at the moment):
declare
  l_image_name my_table1.serial_number%type;  
begin
  select serial_number
    into l_image_name
    from my_table1
    where rownum = 1;

  -- suppose it looks like "12345.jpg". If not, concatenate '.jpg' to serial number

  host (l_image_name);
end;
Re: Opening Picture [message #599403 is a reply to message #599390] Thu, 24 October 2013 04:05 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
do this---simple

READ_IMAGE_FILE('D:\'||:My_table1.serial_number ||'.JPG','JPEG','My_table1.IMAGE4');
------------------------------------------------------------------------------

if you wanna create serial number as well then create serial like this 

WHEN-NEW-BLOCK-INSTANCE 

declare
  a number(7) ;
begin
   select count(*)+1 into :my_table1.serial_number from my_table1;
   :global.a:=:serial_number;
 READ_IMAGE_FILE('D:\'||:My_table1.serial_number ||'.JPG','JPEG','My_table1.IMAGE4');
end;

WHEN-BUTTON-PRESSED

begin
 :global.a := :global.a+1;
    next_record;
 :serial_number := :global.a;
READ_IMAGE_FILE('D:\'||:My_table1.serial_number ||'.JPG','JPEG','My_table1.IMAGE4');
end;


and remember picture name should be 1,2,3... or change according to your requirment

Regard
Mughal Cool

[Updated on: Thu, 24 October 2013 04:07]

Report message to a moderator

Re: Opening Picture [message #599405 is a reply to message #599403] Thu, 24 October 2013 04:22 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
better take fmb it will be more helpful for you Cool

Re: Opening Picture [message #599484 is a reply to message #599405] Thu, 24 October 2013 14:48 Go to previous messageGo to next message
amjad_alahdal
Messages: 102
Registered: October 2013
Location: Saudi Arabia
Senior Member
Thanks you guys,
well, I am using the Oracle Developer 6i, form builder.
Thanks mughals_king.
But what I want is to open it in another thread not displaying it in an item. Just like when you double click the picture inside the folder. I mean I want it to be opened by the photo viewer of the windows
Re: Opening Picture [message #599485 is a reply to message #599484] Thu, 24 October 2013 14:51 Go to previous messageGo to next message
Littlefoot
Messages: 21811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
So, did you try HOST?
Re: Opening Picture [message #599488 is a reply to message #599485] Thu, 24 October 2013 15:05 Go to previous messageGo to next message
amjad_alahdal
Messages: 102
Registered: October 2013
Location: Saudi Arabia
Senior Member
Yes, I did. But, it didn't work.
Re: Opening Picture [message #599490 is a reply to message #599488] Thu, 24 October 2013 15:09 Go to previous messageGo to next message
Littlefoot
Messages: 21811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What happened? Any error? If so, which one?
Re: Opening Picture [message #599491 is a reply to message #599490] Thu, 24 October 2013 15:12 Go to previous messageGo to next message
amjad_alahdal
Messages: 102
Registered: October 2013
Location: Saudi Arabia
Senior Member
I wrote this
host('F:\Amjad\Amjad\Amjad\'||:My_table1.serial_number ||'.JPG');
it opens the dos window and then closes it. it doesn't open the picture
Re: Opening Picture [message #599495 is a reply to message #599491] Thu, 24 October 2013 15:25 Go to previous messageGo to next message
Littlefoot
Messages: 21811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I see; how about (MS Windows, eh?)
host('mspaint F:\Amjad\Amjad\Amjad\'||:My_table1.serial_number ||'.JPG');

You might need to tweak it a little bit; I hope MS Paint will be started and - hopefully - open the image. If it does, try with some other image viewer, if you wish.
Re: Opening Picture [message #599497 is a reply to message #599495] Thu, 24 October 2013 15:42 Go to previous messageGo to next message
amjad_alahdal
Messages: 102
Registered: October 2013
Location: Saudi Arabia
Senior Member
It tried this :

Declare
my_cmd varchar2(512);
Begin
my_cmd := 'rundll32 shell32,ShellExec_RunDLL '|| 'F:\Amjad\Amjad\amjad\'||:My_table1.serial_number ||'.JPG';
HOST(my_cmd, NO_SCREEN);
End;

and it worked
Thanks to you all
Re: Opening Picture [message #599513 is a reply to message #599497] Fri, 25 October 2013 00:17 Go to previous message
Littlefoot
Messages: 21811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Now that's something! Cool, I'm glad you found the solution and shared it with us.
Previous Topic: How to convert Oracle 10g Forms to Oracle 6i Forms
Next Topic: Migration from oracle 10g 32 bit windows forms and reports to 11g linux forms and reports
Goto Forum:
  


Current Time: Thu Jun 13 02:41:04 CDT 2024