This discussion is archived
10 Replies Latest reply: Oct 7, 2009 3:27 AM by 571725 RSS

Display Images using READ_IMAGE_FILE in 10g forms

571725 Newbie
Currently Being Moderated
Hello all, i have a simple question that I'm trying to resolve really quick.

I've created a field on a form in 10g forms that is of IMAGE type. I've given it a name and has given it a FILE_TYPE of GIF.

I've put some code in a POST-QUERY trigger of a block that calls the READ_IMAGE_FILE command, where I enter the filename, file_type, and block.item name. When I leave the path off the image name, forms runtime acts like it cannot find it. I get an FRM message displayed at runtime that says it "Cannot read image file". However, if I put the full path (like something pointing to a hard-coded directory on my C drive where the image file resides), the image displays fine at runtime.

I added the images to my JAR file where I have other images stored so they get opened at runtime under the ORACLE_HOME/forms/java directory. I was thinking that when I gave the filename, runtime would know to pull it out of there. But obviously, that's not what is happening.

Has anyone got ideas on what I could do to get the READ_IMAGE_FILE to display the image without hard-coding a path in?

Any help is appreciated!

Regards,
Chris
  • 1. Re: Display Images using READ_IMAGE_FILE in 10g forms
    Sarah Guru
    Currently Being Moderated
    hi

    can u provide us u r code?


    sarah
  • 2. Re: Display Images using READ_IMAGE_FILE in 10g forms
    Sarah Guru
    Currently Being Moderated
    try at when-new-form-instance trigger.

    try something like this.

    when-new-form-instance trigger


    read_image_file('image.gif', 'gif', ' block.image');

    or

    read_image_file('c:\image.gif', 'gif', 'block.image');


    sarah
  • 3. Re: Display Images using READ_IMAGE_FILE in 10g forms
    571725 Newbie
    Currently Being Moderated
    That's not what I'm trying to accomplish though. I'm trying to bring up a status on current, past, and future orders. When I user queries an order, I display different images to display the order. Like if an order is invoiced, I showed a GIF file specifically for invoiced orders. If an order is past ship date, I show a different image.

    A user opens the form and queries an order. That's why I have to use it in Post Query. If they want all orders for a particular customer (current, past, future), then I want to show the different images.

    So, the When-New-Form-Instance won't work.

    Chris
  • 4. Re: Display Images using READ_IMAGE_FILE in 10g forms
    Sarah Guru
    Currently Being Moderated
    hi

    i think post-query trigger wont fire while using read_image_file built-in.

    Sarah
  • 5. Re: Display Images using READ_IMAGE_FILE in 10g forms
    72789 Newbie
    Currently Being Moderated
    Here are some things to check:
    1) Alll the images in the JAR file should have the same extension
    2) In formsweb.cfg, include the JAR file in the ARCHIVE parameter and set imageBase=codebase
    3) In registry.dat, leave iconpath blank and set iconextension=gif
    4) In your READ_IMAGE_FILE call, use URL as the file type and don't use the extension on the file name. So if the image in your JAR is my_picture.gif, it would be something like READ_IMAGE_FILE('my_picture','URL','myblock.my_image_item');

    If it still doesn't work, enable the Java console and when it comes up, enter the number 5 in the console to enable the highest level of logging. Then have a look at the console to see if the JAR is getting downloaded and where it's attempting to read the image from.
  • 6. Re: Display Images using READ_IMAGE_FILE in 10g forms
    Sarah Guru
    Currently Being Moderated
    hi

    try to use "URL' for GIF icons.

    begin
         :System.Message_Level := '25';
    read_image_file('image.gif','url','Block.image');

    IF NOT FORM_SUCCESS THEN
         MESSAGE('This employee does not have a photo on file.');
    END IF;
    :SYSTEM.MESSAGE_LEVEL := '0';

    end;
  • 7. Re: Display Images using READ_IMAGE_FILE in 10g forms
    618632 Expert
    Currently Being Moderated
    Hi!

    If you want to read the gif files from a jar file, you have to use the URL for the image_type parameter.

    But: This feature is a little bit buggy.
    If you have a multi record block and want to display images with the post-query trigger,
    the images are successfully loaded but will disapear ...

    if you have a single record block, you can try to call the synchronize build-in before you read the image file.

    Another option would be to store the images in the database and query the image block as a detail.

    Regards
  • 8. Re: Display Images using READ_IMAGE_FILE in 10g forms
    49905 Pro
    Currently Being Moderated
    Search path for image files on Application Server is same as for FMX files. "WorkingDirectory" (formsweb.cfg), "FORMS_PATH" (your .env).
    Save image in any of these folders and you should be able to remove hardcoded path.
    Using jar and reading from "URL" will not work in POST-QUERY trigger. There is a published bug: 3371345. READ_IMAGE_FILE('IMAGE','URL','IMAGEITEM'); DOESN'T WORK IN POST-QUERY-TRIGGER.
  • 9. Re: Display Images using READ_IMAGE_FILE in 10g forms
    618632 Expert
    Currently Being Moderated
    I use the read_image_file build-in with the url parameter in a single row block
    and it works fine with a preceding call to the synchronize build-in.
  • 10. Re: Display Images using READ_IMAGE_FILE in 10g forms
    571725 Newbie
    Currently Being Moderated
    Yeah, we're trying to use the POST-QUERY trigger because statuses on orders change throughout the years. We used to use a Wingding fonts that we typed in characters but the font would translate it to look like images (like different colored flags), etc... Our font translator in 10g doesn't so great since I'm limited on Java Fonts.

    So, I have to use a POST-QUERY. I'm thinking we just store the images in a database and call them from there. That might be the easier way to go about it.

    Chris

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points