8 Replies Latest reply: Oct 18, 2013 2:14 PM by Michael Ferrante-Oracle RSS

    Display an static image

    juliojgs

      Could you tell me a good method to display some static images? (just a couple of small logos, which have to display in most of my forms)

       

      I've tried with read_image file , but got this issue:

      read_image_file issue resizing when format=>url

        • 1. Re: Display an static image
          François Degrelle

          Hello,

          There are so many different versions between old C/S and current Web, please think to always give the exact version you use in your every question.

           

          Francois

          • 2. Re: Display an static image
            juliojgs

            Sorry, I forgot (again). Forms 11.1.2.1.0

             

            Also, I didn't say it, but the static image I want to display should read from a file (not just an imported image pasted on the canvas).

            • 3. Re: Display an static image
              François Degrelle

              If you are not affraid by embedding a Java Bean in your application, you can use the HandleImage bean.

               

              Francois

              • 4. Re: Display an static image
                juliojgs

                It seems too much for a simple static image, but if this is the way to go, I'll have to take it.

                Anyway, this is the kind of things I find tiring about forms, complex workarounds for something that should work out-of-the-box

                • 5. Re: Display an static image
                  PavelA-o.

                  Use READ_IMAGE_FILE. Why do you need to put it in the jar file to get the issue you've gave a link to? Just put it somewhere on application server, and load it with read_image_file. It works. For instance in our application we have "images" directory on AS, where all images are located. The path to the directory is specified in our application settings. It is simple and works fine.

                  • 6. Re: Display an static image
                    juliojgs

                    I put it in the jar because I didn't want absolute paths and I already had the icons in the jar working ok.

                    Also, I am developing in windows but the production deployment will be on linux.

                    Let's say I'll deploy the app in folders called

                    /myapp/forms

                    /myapp/lib

                     

                    Maybe I can follow your advice and have a /myapp/images and read_image_file from there, but I would have to set a custom parameter somewhere (db package constant?) to establish the path, so the image can work in development environment (pointing to /myapp in production and to c:\myprojects\myapp in development).

                     

                    But it's a workaround of a bug, like many times.

                    • 7. Re: Display an static image
                      PavelA-o.

                      You can put this parameter in .env file (which is in <as home>/forms/server) and read it with TOOLS_ENV package API. We tried it - it works.

                      I understand you don't want any additional parameters. But if you have a bug, you have to work around.

                      One more question - does your application have got any parameters? I mean Windows have registry to store system settings, other apps store settings in .properties file. And your application - has it got any central settings storage?

                      • 8. Re: Display an static image
                        Michael Ferrante-Oracle

                        If your goal is to simply display an image in an image item and that image is stored on the server and that image should scale to the image item size then all you need to do is the following:

                         

                        1.  Store your image in a directory on the server where the Forms application will have permission to it.

                        2.  Create the image item on your canvas.

                        3.  Set its Sizing Style property to Adjust

                        4.  Add your READ_IMAGE code to the desired trigger.  The code should look like the following (do not include a path).

                         

                        Read_image_file ('myImage.jpg', 'jpg', 'block1.image1');

                         

                        5.  In the default.env, add the path to the location of the image file to FORMS_PATH

                         

                        Run your form. 

                         

                        If you want to jar your image(s) and send it to the client, the process will be slightly more complicated.  For very small images and especially in cases where there are only one or two, jarring is overkill.  Also, because of new restrictions in the JRE, you would need to sign this jar with a trusted certificated.