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:
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.
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
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.
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?
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.